Commit 36ad48b2 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

add OpenMP version detection and info output

parent eb8a6512
Loading
Loading
Loading
Loading
+35 −2
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ void Info::command(int narg, char **arg)
    fprintf(out,"\nLAMMPS version: %s / %s\n\n",
            universe->version, universe->num_ver);

    char *infobuf = get_os_info();
    const char *infobuf = get_os_info();
    fprintf(out,"OS information: %s\n\n",infobuf);
    delete[] infobuf;

@@ -273,7 +273,7 @@ void Info::command(int narg, char **arg)
    fprintf(out,"sizeof(bigint):   %3d-bit\n",(int)sizeof(bigint)*8);

    infobuf = get_compiler_info();
    fprintf(out,"\nCompiler: %s\n",infobuf);
    fprintf(out,"\nCompiler: %s with %s\n",infobuf,get_openmp_info());
    delete[] infobuf;

    fputs("\nActive compile time flags:\n\n",out);
@@ -1150,6 +1150,39 @@ char *Info::get_compiler_info()
  return buf;
}

const char *Info::get_openmp_info()
{

#if !defined(_OPENMP)
  return (const char *)"OpenMP not enabled";
#else

// Supported OpenMP version corresponds to the release date of the
// specifications as posted at https://www.openmp.org/specifications/

#if _OPENMP > 201811
  return (const char *)"OpenMP newer than v5.0";
#if _OPENMP == 201811
  return (const char *)"OpenMP v5.0 or newer";
#elif _OPENMP == 201511
  return (const char *)"OpenMP v4.5";
#elif _OPENMP == 201307
  return (const char *)"OpenMP v4.0";
#elif _OPENMP == 201107
  return (const char *)"OpenMP v3.1";
#elif _OPENMP == 200805
  return (const char *)"OpenMP v3.0";
#elif _OPENMP == 200505
  return (const char *)"OpenMP v2.5";
#elif _OPENMP == 200203
  return (const char *)"OpenMP v2.0";
#else
  return (const char *)"unknown OpenMP version";
#endif

#endif
}

/* ---------------------------------------------------------------------- */

char **Info::get_variable_names(int &num) {
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ class Info : protected Pointers {

  static char *get_os_info();
  static char *get_compiler_info();
  static const char *get_openmp_info();

  char **get_variable_names(int &num);

+1 −1
Original line number Diff line number Diff line
@@ -1087,7 +1087,7 @@ void LAMMPS::print_config(FILE *fp)
  delete[] infobuf;

  infobuf = Info::get_compiler_info();
  fprintf(fp,"Compiler: %s\n\n",infobuf);
  fprintf(fp,"Compiler: %s with %s\n\n",infobuf,Info::get_openmp_info());
  delete[] infobuf;

  fputs("Active compile time flags:\n\n",fp);