Merge pull request #2993 from akohlmey/collected_small_changes
Collected small changes and fixes
This commit is contained in:
@ -617,15 +617,12 @@ foreach(PKG_WITH_INCL CORESHELL QEQ OPENMP DPD-SMOOTH KOKKOS OPT INTEL GPU)
|
||||
endforeach()
|
||||
|
||||
if(PKG_PLUGIN)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
else()
|
||||
message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled")
|
||||
endif()
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
endif()
|
||||
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
|
||||
@ -65,10 +65,8 @@ only enabled if LAMMPS was built with that package.
|
||||
See the :doc:`Build package <Build_package>` page for
|
||||
more info. Plugins are not available on Windows.
|
||||
|
||||
For the loading of plugins to work the LAMMPS library must be
|
||||
:ref:`compiled as a shared library <library>`. If plugins
|
||||
access functions or classes from a package, LAMMPS must have
|
||||
been compiled with that package included.
|
||||
If plugins access functions or classes from a package, LAMMPS must
|
||||
have been compiled with that package included.
|
||||
|
||||
Plugins are dependent on the LAMMPS binary interface (ABI)
|
||||
and particularly the MPI library used. So they are not guaranteed
|
||||
|
||||
@ -1039,10 +1039,18 @@ Device<PRECISION,ACC_PRECISION> global_device;
|
||||
|
||||
using namespace LAMMPS_AL;
|
||||
|
||||
bool lmp_has_gpu_device()
|
||||
// check if a suitable GPU is present.
|
||||
// for mixed and double precision GPU library compilation
|
||||
// also the GPU needs to support double precision.
|
||||
bool lmp_has_compatible_gpu_device()
|
||||
{
|
||||
UCL_Device gpu;
|
||||
return (gpu.num_platforms() > 0);
|
||||
bool compatible_gpu = gpu.num_platforms() > 0;
|
||||
#if defined(_SINGLE_DOUBLE) || defined(_DOUBLE_DOUBLE)
|
||||
if (!gpu.double_precision(0))
|
||||
compatible_gpu = false;
|
||||
#endif
|
||||
return compatible_gpu;
|
||||
}
|
||||
|
||||
std::string lmp_gpu_device_info()
|
||||
|
||||
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@ -1395,6 +1395,8 @@
|
||||
/fix_drude_transform.h
|
||||
/fix_langevin_drude.cpp
|
||||
/fix_langevin_drude.h
|
||||
/fix_mol_swap.cpp
|
||||
/fix_mol_swap.h
|
||||
/fix_pimd.cpp
|
||||
/fix_pimd.h
|
||||
/fix_qbmsst.cpp
|
||||
|
||||
@ -45,7 +45,7 @@ void FixBrownian::init()
|
||||
{
|
||||
FixBrownianBase::init();
|
||||
g1 /= gamma_t;
|
||||
g2 *= sqrt(gamma_t);
|
||||
g2 /= sqrt(gamma_t);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -65,6 +65,9 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl, but should be empty on Windows)
|
||||
|
||||
override DYN_LIB =
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
|
||||
@ -65,6 +65,11 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl)
|
||||
# uncomment to change the default
|
||||
|
||||
# override DYN_LIB =
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
|
||||
@ -65,6 +65,11 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl, should be empty on Windows)
|
||||
# uncomment to change the default
|
||||
|
||||
# override DYN_LIB =
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
@ -74,7 +79,7 @@ include Makefile.package
|
||||
|
||||
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
|
||||
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
|
||||
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
|
||||
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB)
|
||||
EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS)
|
||||
EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS)
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
SHELL = /bin/bash
|
||||
PYTHON = python
|
||||
DYN_LIB = -ldl
|
||||
|
||||
#.IGNORE:
|
||||
|
||||
@ -400,14 +401,14 @@ ifeq ($(mode),static)
|
||||
@cd $(objdir); \
|
||||
$(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" "SHFLAGS =" \
|
||||
"LMPLIB = $(ARLIB)" "ARLIB = $(ARLIB)" "SHLIB = $(SHLIB)" \
|
||||
"LMPLINK = $(LMPLINK)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
"LMPLINK = $(LMPLINK)" "DYN_LIB = $(DYN_LIB)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
@ln -s $(ARLIB) $(ARLINK)
|
||||
endif
|
||||
ifeq ($(mode),shared)
|
||||
@cd $(objdir); \
|
||||
$(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" \
|
||||
"LMPLIB = $(SHLIB)" "ARLIB = $(ARLIB)" "SHLIB = $(SHLIB)" \
|
||||
"LMPLINK = $(LMPLINK)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
"LMPLINK = $(LMPLINK)" "DYN_LIB = $(DYN_LIB)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
@ln -s $(SHLIB) $(SHLINK)
|
||||
endif
|
||||
# backward compatibility
|
||||
|
||||
@ -866,15 +866,14 @@ void FixACKS2ReaxFF::more_reverse_comm(double *vec)
|
||||
double FixACKS2ReaxFF::memory_usage()
|
||||
{
|
||||
double bytes;
|
||||
|
||||
int size = 2*nmax + 2;
|
||||
const double size = 2.0*nmax + 2.0;
|
||||
|
||||
bytes = size*nprev * sizeof(double); // s_hist
|
||||
bytes += nmax*4 * sizeof(double); // storage
|
||||
bytes += size*11 * sizeof(double); // storage
|
||||
bytes += n_cap*4 * sizeof(int); // matrix...
|
||||
bytes += m_cap*2 * sizeof(int);
|
||||
bytes += m_cap*2 * sizeof(double);
|
||||
bytes += nmax*4.0 * sizeof(double); // storage
|
||||
bytes += size*11.0 * sizeof(double); // storage
|
||||
bytes += n_cap*4.0 * sizeof(int); // matrix...
|
||||
bytes += m_cap*2.0 * sizeof(int);
|
||||
bytes += m_cap*2.0 * sizeof(double);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
25
src/atom.cpp
25
src/atom.cpp
@ -260,6 +260,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
map_hash = nullptr;
|
||||
|
||||
unique_tags = nullptr;
|
||||
reset_image_flag[0] = reset_image_flag[1] = reset_image_flag[2] = false;
|
||||
|
||||
atom_style = nullptr;
|
||||
avec = nullptr;
|
||||
@ -1134,7 +1135,6 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
// remap atom into simulation box
|
||||
// if atom is in my sub-domain, unpack its values
|
||||
|
||||
int flagx = 0, flagy = 0, flagz = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
|
||||
@ -1154,9 +1154,9 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
imz = utils::inumeric(FLERR,values[iptr+2],false,lmp);
|
||||
if ((domain->dimension == 2) && (imz != 0))
|
||||
error->all(FLERR,"Z-direction image flag must be 0 for 2d-systems");
|
||||
if ((!domain->xperiodic) && (imx != 0)) { flagx = 1; imx = 0; }
|
||||
if ((!domain->yperiodic) && (imy != 0)) { flagy = 1; imy = 0; }
|
||||
if ((!domain->zperiodic) && (imz != 0)) { flagz = 1; imz = 0; }
|
||||
if ((!domain->xperiodic) && (imx != 0)) { reset_image_flag[0] = true; imx = 0; }
|
||||
if ((!domain->yperiodic) && (imy != 0)) { reset_image_flag[1] = true; imy = 0; }
|
||||
if ((!domain->zperiodic) && (imz != 0)) { reset_image_flag[2] = true; imz = 0; }
|
||||
}
|
||||
imagedata = ((imageint) (imx + IMGMAX) & IMGMASK) |
|
||||
(((imageint) (imy + IMGMAX) & IMGMASK) << IMGBITS) |
|
||||
@ -1192,23 +1192,6 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset,
|
||||
|
||||
buf = next + 1;
|
||||
}
|
||||
|
||||
// warn if reading data with non-zero image flags for non-periodic boundaries.
|
||||
// we may want to turn this into an error at some point, since this essentially
|
||||
// creates invalid position information that works by accident most of the time.
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (flagx)
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in x direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
if (flagy)
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in y direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
if (flagz)
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in z direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
}
|
||||
|
||||
delete [] values;
|
||||
}
|
||||
|
||||
|
||||
@ -270,6 +270,10 @@ class Atom : protected Pointers {
|
||||
|
||||
int *sametag; // sametag[I] = next atom with same ID, -1 if no more
|
||||
|
||||
// true if image flags were reset to 0 during data_atoms()
|
||||
|
||||
bool reset_image_flag[3];
|
||||
|
||||
// AtomVec factory types and map
|
||||
|
||||
typedef AtomVec *(*AtomVecCreator)(LAMMPS *);
|
||||
|
||||
@ -1146,12 +1146,14 @@ bool Info::has_package(const std::string &package_name) {
|
||||
|
||||
#if defined(LMP_GPU)
|
||||
extern bool lmp_gpu_config(const std::string &, const std::string &);
|
||||
extern bool lmp_has_gpu_device();
|
||||
extern bool lmp_has_compatible_gpu_device();
|
||||
extern std::string lmp_gpu_device_info();
|
||||
|
||||
// we will only report compatible GPUs, i.e. when a GPU device is
|
||||
// available *and* supports the required floating point precision
|
||||
bool Info::has_gpu_device()
|
||||
{
|
||||
return lmp_has_gpu_device();
|
||||
return lmp_has_compatible_gpu_device();
|
||||
}
|
||||
|
||||
std::string Info::get_gpu_device_info()
|
||||
|
||||
@ -1340,7 +1340,7 @@ void LAMMPS::print_config(FILE *fp)
|
||||
fmt::print(fp,"Accelerator configuration:\n\n{}\n",
|
||||
Info::get_accelerator_info());
|
||||
#if defined(LMP_GPU)
|
||||
fmt::print(fp,"GPU present: {}\n\n",Info::has_gpu_device() ? "yes" : "no");
|
||||
fmt::print(fp,"Compatible GPU present: {}\n\n",Info::has_gpu_device() ? "yes" : "no");
|
||||
#endif
|
||||
|
||||
fputs("Active compile time flags:\n\n",fp);
|
||||
|
||||
@ -312,6 +312,10 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,fmt::format("Cannot open file {}: {}",
|
||||
arg[0], utils::getsyserror()));
|
||||
|
||||
// reset so we can warn about reset image flags exactly once per data file
|
||||
|
||||
atom->reset_image_flag[0] = atom->reset_image_flag[1] = atom->reset_image_flag[2] = false;
|
||||
|
||||
// first time system initialization
|
||||
|
||||
if (addflag == NONE) {
|
||||
@ -1238,6 +1242,22 @@ void ReadData::atoms()
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
// warn if we have read data with non-zero image flags for non-periodic boundaries.
|
||||
// we may want to turn this into an error at some point, since this essentially
|
||||
// creates invalid position information that works by accident most of the time.
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (atom->reset_image_flag[0])
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in x direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
if (atom->reset_image_flag[1])
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in y direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
if (atom->reset_image_flag[2])
|
||||
error->warning(FLERR,"Non-zero imageflag(s) in z direction for "
|
||||
"non-periodic boundary reset to zero");
|
||||
}
|
||||
|
||||
// check that all atoms were assigned correctly
|
||||
|
||||
bigint n = atom->nlocal;
|
||||
|
||||
Reference in New Issue
Block a user