Unverified Commit b53df3dd authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

disable optimization on functions building factories for many entries

this will speed up compilation and also avoid spurious warnings with gcc 4.4 and later
parent 56e3b1d1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -80,7 +80,11 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp)
  strcpy(kspace_style,str);

  pair_restart = NULL;
  create_factories();
}

void _noopt Force::create_factories()
{
  // fill pair map with pair styles listed in style_pair.h

  pair_map = new PairCreatorMap();
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ class Force : protected Pointers {
  bigint memory_usage();

 private:
  void create_factories();
  template <typename T> static Pair *pair_creator(LAMMPS *);
  template <typename T> static Bond *bond_creator(LAMMPS *);
  template <typename T> static Angle *angle_creator(LAMMPS *);
+3 −9
Original line number Diff line number Diff line
@@ -53,12 +53,6 @@
#include "memory.h"
#include "error.h"

#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))
#pragma GCC optimize ("no-var-tracking-assignments")
#endif
#endif

#include "lmpinstalledpkgs.h"
#include "lmpgitversion.h"

@@ -902,7 +896,7 @@ void LAMMPS::destroy()
   initialize lists of styles in packages
------------------------------------------------------------------------- */

void LAMMPS::init_pkg_lists()
void _noopt LAMMPS::init_pkg_lists()
{
  pkg_lists = new package_styles_lists;
#define PACKAGE "UNKNOWN"
@@ -1045,7 +1039,7 @@ const char *LAMMPS::match_style(const char *style, const char *name)
   help message for command line options and styles present in executable
------------------------------------------------------------------------- */

void LAMMPS::help()
void _noopt LAMMPS::help()
{
  FILE *fp = screen;
  const char *pager = NULL;
+20 −0
Original line number Diff line number Diff line
@@ -179,6 +179,9 @@ typedef int bigint;
#ifdef _noalias
#undef _noalias
#endif
#ifdef _noopt
#undef _noopt
#endif

// define stack variable alignment

@@ -200,6 +203,23 @@ typedef int bigint;
#define _noalias
#endif

// declaration to turn off optimization for specific functions
// and avoid compiler warnings about variable tracking

#if defined(__clang__)
#  define _noopt __attribute__((optnone))
#elif defined(__INTEL_COMPILER)
#  define _noopt
#elif defined(__GNUC__)
#  if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))
#    define _noopt __attribute__((optimize("O0","no-var-tracking-assignments")))
#  else
#    define _noopt __attribute__((optimize("O0")))
#  endif
#else
#  define _noopt
#endif

// settings to enable LAMMPS to build under Windows

#ifdef _WIN32
+5 −0
Original line number Diff line number Diff line
@@ -81,6 +81,11 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp)
  ncompute = maxcompute = 0;
  compute = NULL;

  create_factories();
}

void _noopt Modify::create_factories()
{
  // fill map with fixes listed in style_fix.h

  fix_map = new FixCreatorMap();
Loading