Merge pull request #2868 from akohlmey/collected-small-changes

Collected small changes
This commit is contained in:
Axel Kohlmeyer
2021-08-06 18:35:29 -04:00
committed by GitHub
22 changed files with 111 additions and 107 deletions

View File

@ -3,7 +3,7 @@ if(NOT FOUND_IMMINTRIN)
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
endif()
target_compile_definitions(lammps PRIVATE -DLMP_USER_INTEL)
target_compile_definitions(lammps PRIVATE -DLMP_INTEL)
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by INTEL (cpu or knl)")
set(INTEL_ARCH_VALUES cpu knl)

View File

@ -114,5 +114,5 @@ else()
target_link_libraries(lmp PRIVATE ${mdi_LIBRARY})
endif()
target_compile_definitions(lammps PRIVATE -DLMP_USER_MDI)
target_compile_definitions(lmp PRIVATE -DLMP_USER_MDI)
target_compile_definitions(lammps PRIVATE -DLMP_MDI)
target_compile_definitions(lmp PRIVATE -DLMP_MDI)

View File

@ -5,7 +5,7 @@
${OPENMP_SOURCES_DIR}/fix_nh_omp.cpp
${OPENMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp
${OPENMP_SOURCES_DIR}/domain_omp.cpp)
target_compile_definitions(lammps PRIVATE -DLMP_USER_OMP)
target_compile_definitions(lammps PRIVATE -DLMP_OPENMP)
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${OPENMP_SOURCES}")
# detects styles which have OPENMP version

View File

@ -68,7 +68,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
// this is so final order of Modify:fix will conform to input script
fix_history = nullptr;
modify->add_fix("NEIGH_HISTORY_HH_DUMMY all DUMMY");
modify->add_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me)+" all DUMMY");
fix_dummy = (FixDummy *) modify->fix[modify->nfix-1];
}
@ -80,8 +80,8 @@ PairGranHookeHistory::~PairGranHookeHistory()
delete [] svector;
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY");
else modify->delete_fix("NEIGH_HISTORY_HH");
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me));
else modify->delete_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
if (allocated) {
memory->destroy(setflag);
@ -436,10 +436,9 @@ void PairGranHookeHistory::init_style()
// this is so its order in the fix list is preserved
if (history && (fix_history == nullptr)) {
auto cmd = fmt::format("NEIGH_HISTORY_HH all NEIGH_HISTORY {}",
size_history);
modify->replace_fix("NEIGH_HISTORY_HH_DUMMY",cmd,1);
int ifix = modify->find_fix("NEIGH_HISTORY_HH");
auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history);
modify->replace_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me),cmd,1);
int ifix = modify->find_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
fix_history = (FixNeighHistory *) modify->fix[ifix];
fix_history->pair = this;
}
@ -507,7 +506,7 @@ void PairGranHookeHistory::init_style()
// set fix which stores history info
if (history) {
int ifix = modify->find_fix("NEIGH_HISTORY_HH");
int ifix = modify->find_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID");
fix_history = (FixNeighHistory *) modify->fix[ifix];
}

View File

@ -56,7 +56,7 @@ if (test $mode = 1) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*INTEL[^ \t]* //' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_INTEL |' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_INTEL |' ../Makefile.package
fi
elif (test $mode = 0) then

View File

@ -50,7 +50,7 @@
#ifndef LMP_INTEL_PREPROCESS_H
#define LMP_INTEL_PREPROCESS_H
// LAMMPS_MEMALIGN is set to 64 by default for -DLMP_USER_INTEL
// LAMMPS_MEMALIGN is set to 64 by default for -DLMP_INTEL
// so we only need to error out in case of a different alignment
#if LAMMPS_MEMALIGN && (LAMMPS_MEMALIGN != 64)
#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS of your LAMMPS makefile for INTEL package

View File

@ -40,7 +40,7 @@ if (test $1 = 1) then
sed -i -e 's/[^ \t]*mdi[^ \t]* //g' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/mdi/includelink |' ../Makefile.package
sed -i -e 's/[^ \t]*MDI[^ \t]* //' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_MDI |' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_MDI |' ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/mdi/liblink |' ../Makefile.package
sed -i -e 's|^PKG_LIB =[ \t]*|&-lmdi |' ../Makefile.package
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(mdi_SYSINC) |' ../Makefile.package

View File

@ -54,7 +54,7 @@ if (test $mode = 1) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_OMP |' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_OPENMP |' ../Makefile.package
fi
# need to delete a bunch of dependency files because they
@ -65,7 +65,7 @@ if (test $mode = 1) then
rm -f ../Obj_*/$f
done
# force rebuild of files with LMP_USER_OMP switch
# force rebuild of files with LMP_OPENMP switch
touch ../accelerator_omp.h
@ -83,7 +83,7 @@ elif (test $mode = 0) then
rm -f ../Obj_*/$f
done
# force rebuild of files with LMP_USER_OMP switch
# force rebuild of files with LMP_OPENMP switch
touch ../accelerator_omp.h

View File

@ -141,9 +141,9 @@ namespace ReaxFF
// toolbox
extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const char *);
extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const char *);
extern void sfree(LAMMPS_NS::Error *, void *, const char *);
extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const std::string &);
extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const std::string &);
extern void sfree(LAMMPS_NS::Error *, void *, const std::string &);
// torsion angles

View File

@ -1,4 +1,3 @@
// clang-format off
/*----------------------------------------------------------------------
PuReMD - Purdue ReaxFF Molecular Dynamics Program
@ -35,75 +34,81 @@
namespace ReaxFF {
/* safe malloc */
void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name)
{
void *ptr;
/* safe malloc */
void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const std::string &name)
{
void *ptr;
if (n <= 0) {
auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. "
"returning NULL.", n, name);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
if (n <= 0) {
auto errmsg = fmt::format("Invalid size {} for array {}. Returning NULL.", n, name);
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
return nullptr;
}
ptr = malloc(n);
if (ptr == nullptr) {
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
n, name);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
}
return ptr;
return nullptr;
}
/* safe calloc */
void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name)
{
void *ptr;
if (n <= 0) {
auto errmsg = fmt::format("Trying to allocate {} elements for array {}. "
"returning NULL.\n", n, name);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
return nullptr;
}
if (size <= 0) {
auto errmsg = fmt::format("Elements size for array {} is {}. "
"returning NULL", name, size);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
return nullptr;
}
ptr = calloc(n, size);
if (ptr == nullptr) {
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
n*size, name);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
}
return ptr;
ptr = malloc(n);
if (ptr == nullptr) {
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", n, name);
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
}
/* safe free */
void sfree(LAMMPS_NS::Error* error_ptr, void *ptr, const char *name)
{
if (ptr == nullptr) {
auto errmsg = fmt::format("Trying to free the already free()'d pointer {}",
name);
if (error_ptr) error_ptr->one(FLERR,errmsg);
else fputs(errmsg.c_str(),stderr);
return;
}
free(ptr);
ptr = nullptr;
}
return ptr;
}
/* safe calloc */
void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const std::string &name)
{
void *ptr;
if (n <= 0) {
auto errmsg = fmt::format("Invalid size {} for array {}. Returning NULL.\n", n, name);
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
return nullptr;
}
if (size <= 0) {
auto errmsg = fmt::format("Elements size for array {} is {}. Returning NULL", name, size);
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
return nullptr;
}
ptr = calloc(n, size);
if (ptr == nullptr) {
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", n * size, name);
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
}
return ptr;
}
/* safe free */
void sfree(LAMMPS_NS::Error *error_ptr, void *ptr, const std::string &name)
{
if (ptr == nullptr) {
auto errmsg = std::string("Trying to free the already free()'d pointer: ") + name;
if (error_ptr)
error_ptr->one(FLERR, errmsg);
else
fputs(errmsg.c_str(), stderr);
return;
}
free(ptr);
ptr = nullptr;
}
} // namespace ReaxFF

View File

@ -13,7 +13,7 @@
// NOTE: this file is *supposed* to be included multiple times
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
// true interface to OPENMP
@ -41,4 +41,4 @@ class DomainOMP : public Domain {
#endif /* LMP_DOMAIN_OMP_H */
#endif /* !LMP_USER_OMP */
#endif /* !LMP_OPENMP */

View File

@ -38,7 +38,7 @@
#include <cmath>
#include <cstring>
#ifdef LMP_USER_INTEL
#ifdef LMP_INTEL
#include "neigh_request.h"
#endif
@ -2196,7 +2196,7 @@ void Atom::setup_sort_bins()
bininvy = nbiny / (bboxhi[1]-bboxlo[1]);
bininvz = nbinz / (bboxhi[2]-bboxlo[2]);
#ifdef LMP_USER_INTEL
#ifdef LMP_INTEL
int intel_neigh = 0;
if (neighbor->nrequest) {
if (neighbor->requests[0]->intel) intel_neigh = 1;

View File

@ -34,7 +34,7 @@
#include <cmath>
#include <cstring>
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
#include "modify.h"
#include "fix_omp.h"
#include "thr_data.h"
@ -48,7 +48,7 @@ static void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt,
MPI_Comm world, const int nprocs, const int nthreads,
const int me, double time_loop, FILE *scr, FILE *log);
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
static void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
const int nthreads,FILE *scr, FILE *log);
#endif
@ -363,7 +363,7 @@ void Finish::end(int flag)
}
}
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
int ifix = modify->find_fix("package_omp");
// print thread breakdown only with full timer detail
@ -691,7 +691,7 @@ void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt,
/* ---------------------------------------------------------------------- */
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
const int nthreads,FILE *scr, FILE *log)
{

View File

@ -1222,7 +1222,7 @@ bool Info::has_accelerator_feature(const std::string &package,
return lmp_gpu_config(category,setting);
}
#endif
#if defined(LMP_USER_OMP)
#if defined(LMP_OPENMP)
if (package == "OPENMP") {
if (category == "precision") {
if (setting == "double") return true;
@ -1238,7 +1238,7 @@ bool Info::has_accelerator_feature(const std::string &package,
}
}
#endif
#if defined(LMP_USER_INTEL)
#if defined(LMP_INTEL)
if (package == "INTEL") {
if (category == "precision") {
if (setting == "double") return true;

View File

@ -798,7 +798,7 @@ void LAMMPS::create()
else neighbor = new Neighbor(this);
if (kokkos) domain = new DomainKokkos(this);
#ifdef LMP_USER_OMP
#ifdef LMP_OPENMP
else domain = new DomainOMP(this);
#else
else domain = new Domain(this);

View File

@ -31,7 +31,7 @@
#endif
// import MolSSI Driver Interface library
#if defined(LMP_USER_MDI)
#if defined(LMP_MDI)
#include <mdi.h>
#endif
@ -47,7 +47,7 @@ int main(int argc, char **argv)
MPI_Comm lammps_comm = MPI_COMM_WORLD;
#if defined(LMP_USER_MDI)
#if defined(LMP_MDI)
// initialize MDI interface, if compiled in
int mdi_flag;

View File

@ -16,7 +16,7 @@
#include "error.h"
#if defined(LMP_USER_INTEL) && \
#if defined(LMP_INTEL) && \
((defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)))
#ifndef LMP_INTEL_NO_TBB
#define LMP_USE_TBB_ALLOCATOR
@ -31,7 +31,7 @@
#endif
#endif
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64
#endif

View File

@ -985,7 +985,7 @@ void Modify::replace_fix(const char *replaceID,
int narg, char **arg, int trysuffix)
{
int ifix = find_fix(replaceID);
if (ifix < 0) error->all(FLERR,"Modify replace_fix ID could not be found");
if (ifix < 0) error->all(FLERR,"Modify replace_fix ID {} could not be found", replaceID);
// change ID, igroup, style of fix being replaced to match new fix
// requires some error checking on arguments for new fix

View File

@ -16,7 +16,7 @@
#include <cstdlib>
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64
#endif

View File

@ -16,7 +16,7 @@
#include <cstdlib>
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64
#endif

View File

@ -2,7 +2,7 @@
lammps_version: 8 Apr 2021
date_generated: Tue Apr 20 14:47:51 2021
epsilon: 7.5e-13
skip_tests: intel single
skip_tests: intel single gpu
prerequisites: ! |
pair buck/coul/cut
fix qeq/point

View File

@ -2,7 +2,7 @@
lammps_version: 8 Apr 2021
date_generated: Tue Apr 20 14:48:00 2021
epsilon: 7.5e-13
skip_tests: intel single
skip_tests: intel single gpu
prerequisites: ! |
pair buck/coul/cut
fix qeq/shielded