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

Collected small changes and bugfixes
This commit is contained in:
Axel Kohlmeyer
2020-04-28 11:52:54 -04:00
committed by GitHub
20 changed files with 179 additions and 56 deletions

View File

@ -135,23 +135,20 @@ if(PKG_USER-ADIOS)
target_link_libraries(lammps PRIVATE adios2::adios2)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
option(BUILD_MPI "Build MPI version" OFF)
else()
# do MPI detection after language activation,
# in case MPI for these languages is required
if(NOT CMAKE_CROSSCOMPILING)
set(MPI_CXX_SKIP_MPICXX TRUE)
find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
else()
option(BUILD_MPI "Build MPI version" OFF)
endif()
if(BUILD_MPI)
# We use a non-standard procedure to compile with MPI on windows
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
# We use a non-standard procedure to cross-compile with MPI on Windows
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND CMAKE_CROSSCOMPILING)
include(MPI4WIN)
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
else()
set(MPI_CXX_SKIP_MPICXX ON)
find_package(MPI REQUIRED)
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
@ -332,8 +329,9 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific opt
separate_arguments(CMAKE_TUNE_FLAGS)
include(CheckCXXCompilerFlag)
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
if(COMPILER_SUPPORTS${_FLAG})
string(REGEX REPLACE "[=\"]" "" _FLAGX ${_FLAG})
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAGX})
if(COMPILER_SUPPORTS${_FLAGX})
target_compile_options(lammps PRIVATE ${_FLAG})
else()
message(WARNING "${_FLAG} found in CMAKE_TUNE_FLAGS, but not supported by the compiler, skipping")
@ -705,6 +703,7 @@ else()
endif()
if(BUILD_MPI)
message(STATUS "<<< MPI flags >>>
-- MPI_defines: ${MPI_CXX_COMPILE_DEFINITIONS}
-- MPI includes: ${MPI_CXX_INCLUDE_PATH}
-- MPI libraries: ${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
endif()

View File

@ -23,3 +23,8 @@ set_target_properties(MPI::MPI_CXX PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
add_dependencies(MPI::MPI_CXX mpi4win_build)
# set variables for status reporting at the end of CMake run
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")

View File

@ -330,7 +330,7 @@ elseif(GPU_API STREQUAL "HIP")
if(HIP_PLATFORM STREQUAL "nvcc")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/include)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
@ -338,6 +338,12 @@ elseif(GPU_API STREQUAL "HIP")
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/include)
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
elseif(HIP_PLATFORM STREQUAL "hcc")
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_HCC__)
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
endif()
target_link_libraries(lammps PRIVATE gpu)
@ -353,7 +359,12 @@ RegisterStylesExt(${GPU_SOURCES_DIR} gpu GPU_SOURCES)
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
target_link_libraries(gpu PRIVATE MPI::MPI_CXX)
if(NOT BUILD_MPI)
# mpistubs is aliased to MPI::MPI_CXX, but older versions of cmake won't work forward the include path
target_link_libraries(gpu PRIVATE mpi_stubs)
else()
target_link_libraries(gpu PRIVATE MPI::MPI_CXX)
endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS gpu EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -1,4 +1,11 @@
enable_language(Fortran)
# using lammps in a super-build setting
if(TARGET LATTE::latte)
target_link_libraries(lammps PRIVATE LATTE::latte)
return()
endif()
find_package(LATTE)
if(LATTE_FOUND)
set(DOWNLOAD_LATTE_DEFAULT OFF)
@ -35,5 +42,6 @@ else()
if(NOT LATTE_FOUND)
message(FATAL_ERROR "LATTE library not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it")
endif()
target_link_libraries(lammps PRIVATE LATTE::latte)
# latte needs lapack
target_link_libraries(lammps PRIVATE LATTE::latte ${LAPACK_LIBRARIES})
endif()

View File

@ -2,7 +2,7 @@
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBG" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
set(MPI_CXX "clang++" CACHE STRING "" FORCE)
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)

12
cmake/presets/hip.cmake Normal file
View File

@ -0,0 +1,12 @@
# preset that will enable hipcc plus gcc with support for MPI and OpenMP (on Linux boxes)
set(CMAKE_CXX_COMPILER "hipcc" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
unset(HAVE_OMP_H_INCLUDE CACHE)
set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE)
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)

View File

@ -17,6 +17,8 @@
#ifndef ZMQ_DUMMY_H
#define ZMQ_DUMMY_H
#include <cstddef>
namespace CSLIB_NS {
#define ZMQ_REQ 0

View File

@ -161,7 +161,7 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::compute_peratom()
d_distsq = t_sna_2d_lr("orientorder/atom:distsq",chunk_size,maxneigh);
d_nearest = t_sna_2i_lr("orientorder/atom:nearest",chunk_size,maxneigh);
d_rlist = t_sna_3d_lr("orientorder/atom:rlist",chunk_size,maxneigh,3);
d_distsq_um = d_distsq;
d_rlist_um = d_rlist;
d_nearest_um = d_nearest;
@ -194,11 +194,11 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::compute_peratom()
typename Kokkos::TeamPolicy<DeviceType, TagComputeOrientOrderAtomNeigh> policy_neigh(chunk_size,team_size,vector_length);
Kokkos::parallel_for("ComputeOrientOrderAtomNeigh",policy_neigh,*this);
}
//Select3
typename Kokkos::RangePolicy<DeviceType, TagComputeOrientOrderAtomSelect3> policy_select3(0,chunk_size);
Kokkos::parallel_for("ComputeOrientOrderAtomSelect3",policy_select3,*this);
//BOOP1
{
int vector_length = vector_length_default;
@ -207,7 +207,7 @@ void ComputeOrientOrderAtomKokkos<DeviceType>::compute_peratom()
typename Kokkos::TeamPolicy<DeviceType, TagComputeOrientOrderAtomBOOP1> policy_boop1(((chunk_size+team_size-1)/team_size)*maxneigh,team_size,vector_length);
Kokkos::parallel_for("ComputeOrientOrderAtomBOOP1",policy_boop1,*this);
}
//BOOP2
typename Kokkos::RangePolicy<DeviceType, TagComputeOrientOrderAtomBOOP2> policy_boop2(0,chunk_size);
Kokkos::parallel_for("ComputeOrientOrderAtomBOOP2",policy_boop2,*this);

View File

1
src/MAKE/MINE/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/Makefile.*

View File

@ -27,12 +27,12 @@ SHLIBFLAGS = -shared
# if you change any -D setting, do full re-compile after "make clean"
# LAMMPS ifdef settings
# see possible settings in Section 2.2 (step 4) of manual
# see possible settings in Section 3.5 of the manual
LMP_INC = -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64
# MPI library
# see discussion in Section 2.2 (step 5) of manual
# see discussion in Section 3.4 of the manual
# MPI wrapper compiler/linker can provide this info
# can point to dummy MPI library in src/STUBS as in Makefile.serial
# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
@ -45,7 +45,7 @@ MPI_PATH =
MPI_LIB =
# FFT library
# see discussion in Section 2.2 (step 6) of manual
# see discussion in Section 3.5.2 of manual
# can be left blank to use provided KISS FFT library
# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
# PATH = path for FFT library
@ -56,7 +56,7 @@ FFT_PATH =
FFT_LIB =
# JPEG and/or PNG library
# see discussion in Section 2.2 (step 7) of manual
# see discussion in Section 3.5.4 of manual
# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
# INC = path(s) for jpeglib.h and/or png.h
# PATH = path(s) for JPEG library and/or PNG library
@ -91,18 +91,22 @@ vpath %.h ..
# Link target
$(EXE): $(OBJ) $(EXTRA_LINK_DEPENDS)
$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
$(SIZE) $(EXE)
$(EXE): main.o $(LMPLIB) $(EXTRA_LINK_DEPENDS)
$(LINK) $(LINKFLAGS) main.o $(EXTRA_PATH) $(LMPLINK) $(EXTRA_LIB) $(LIB) -o $@
$(SIZE) $@
# Library targets
lib: $(OBJ) $(EXTRA_LINK_DEPENDS)
$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
$(ARLIB): $(OBJ) $(EXTRA_LINK_DEPENDS)
$(ARCHIVE) $(ARFLAGS) ../$(ARLIB) $(OBJ)
@rm -f $(ARLIB)
@ln -s ../$(ARLIB) $(ARLIB)
shlib: $(OBJ) $(EXTRA_LINK_DEPENDS)
$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \
$(OBJ) $(EXTRA_LIB) $(LIB)
$(SHLIB): $(OBJ) $(EXTRA_LINK_DEPENDS)
$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o ../$(SHLIB) \
$(OBJ) $(EXTRA_LIB) $(LIB)
@rm -f $(SHLIB)
@ln -s ../$(SHLIB) $(SHLIB)
# Compilation rules

View File

@ -33,6 +33,7 @@
#include "neigh_request.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
@ -116,8 +117,8 @@ void PairDRIP::allocate()
void PairDRIP::settings(int narg, char ** /* arg */)
{
if (narg != 0) error->all(FLERR,"Illegal pair_style command");
if (strcmp(force->pair_style,"hybrid/overlay")!=0)
error->all(FLERR,"ERROR: requires hybrid/overlay pair_style");
if (!utils::strmatch(force->pair_style,"^hybrid/overlay"))
error->all(FLERR,"Pair style drip must be used as sub-style with hybrid/overlay");
}
/* ----------------------------------------------------------------------

View File

@ -1007,7 +1007,7 @@ void *PairHybrid::extract(const char *str, int &dim)
for (int m = 0; m < nstyles; m++) {
ptr = styles[m]->extract(str,dim);
if (ptr && strcmp(str,"cut_coul") == 0) {
if (cutptr && dim != couldim)
if (couldim != -1 && dim != couldim)
error->all(FLERR,
"Coulomb styles of pair hybrid sub-styles do not match");
double *p_newvalue = (double *) ptr;

View File

@ -53,7 +53,7 @@ make
| ubuntu16.04.def | Ubuntu 16.04LTS with MPI == OpenMPI, no LaTeX |
| ubuntu18.04.def | Ubuntu 18.04LTS with MPI == OpenMPI |
| ubuntu18.04_amd_rocm.def | Ubuntu 18.04LTS with AMD ROCm toolkit |
| ubuntu18.04_amd_rocm_cuda.def | Ubuntu 18.04LTS with -"- plus Nvidia CUDA 10.2 |
| ubuntu18.04_gpu.def | Ubuntu 18.04LTS with -"- plus Nvidia CUDA 10.2 |
| ubuntu18.04_nvidia.def | Ubuntu 18.04LTS with Nvidia CUDA 10.2 toolkit |
| ubuntu18.04_intel_opencl.def | Ubuntu 18.04LTS with Intel OpenCL runtime |
| ubuntu20.04.def | Ubuntu 20.04LTS with MPI == OpenMPI |

View File

@ -3,9 +3,11 @@ From: fedora:30
%post
dnf -y update
dnf -y install vim-enhanced git file make cmake patch which file \
dos2unix findutils rsync \
ccache gcc-c++ gdb valgrind eigen3-devel \
dnf -y install vim-enhanced git file make cmake patch which file Lmod \
ninja-build clang libomp-devel libubsan libasan libtsan \
dos2unix findutils rsync python-devel libjpeg-devel libpng-devel \
ccache gcc-c++ gcc-gfortran gdb valgrind eigen3-devel openblas-devel \
openmpi-devel mpich-devel fftw-devel voro++-devel gsl-devel \
mingw-filesystem-base mingw32-nsis mingw-binutils-generic \
mingw32-filesystem mingw32-pkg-config \
mingw64-filesystem mingw64-pkg-config \
@ -39,7 +41,7 @@ From: fedora:30
# we need to reset any module variables
# inherited from the host.
unset LOADEDMODULES
source /etc/profile.d/modules.sh
. /etc/profile.d/modules.sh
module purge
module load mpi

View File

@ -38,6 +38,8 @@ From: fedora:32
%environment
LC_ALL=C
export LC_ALL
# we need to reset any module variables
# inherited from the host.
unset LOADEDMODULES
. /etc/profile.d/modules.sh
module purge

View File

@ -57,12 +57,6 @@ From: rocm/dev-ubuntu-18.04
rocm-libs \
rsync \
ssh \
texlive \
texlive-latex-recommended \
texlive-pictures \
texlive-publishers \
texlive-science \
dvipng \
vim-nox \
virtualenv \
voro++-dev \

View File

@ -0,0 +1,94 @@
BootStrap: docker
From: rocm/dev-ubuntu-18.04
%environment
export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
export CUDADIR=/usr/local/cuda
export CUDA_PATH=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
export LIBRARY_PATH=/usr/local/cuda/lib64/stubs
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get upgrade --no-install-recommends -y
apt-get install --no-install-recommends -y software-properties-common
apt-get install --no-install-recommends -y \
bc \
build-essential \
ccache \
clang \
cmake \
cmake-curses-gui \
curl \
doxygen \
enchant \
g++ \
gcc \
gfortran \
git \
hdf5-tools \
kmod \
less \
libblas-dev \
libeigen3-dev \
libenchant-dev \
libfftw3-dev \
libgsl-dev \
libhdf5-serial-dev \
libhwloc-dev \
libjpeg-dev \
liblapack-dev \
libomp-dev \
libopenblas-dev \
libnuma-dev \
libpng-dev \
libproj-dev \
libvtk6-dev \
make \
mpi-default-bin \
mpi-default-dev \
ninja-build \
python-dev \
python-pip \
python-pygments \
python-virtualenv \
python3-dev \
python3-pip \
python3-pkg-resources \
python3-setuptools \
python3-virtualenv \
rocm-libs \
rsync \
ssh \
vim-nox \
virtualenv \
voro++-dev \
wget \
xxd
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
apt-get update
apt-get install --no-install-recommends -y \
cuda \
cuda-compiler-10-2 \
export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
git clone -b master-rocm-3.3 https://github.com/ROCmSoftwarePlatform/hipCUB.git
mkdir hipCUB/build
cd hipCUB/build
CXX=hcc cmake -D BUILD_TEST=off ..
make -j4
make package
make install
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
%environment
LC_ALL=C
export LC_ALL
%labels
Author rbberger

View File

@ -55,12 +55,6 @@ From: ubuntu:18.04
python3-virtualenv \
rsync \
ssh \
texlive \
texlive-latex-recommended \
texlive-pictures \
texlive-publishers \
texlive-science \
dvipng \
vim-nox \
virtualenv \
voro++-dev \

View File

@ -55,12 +55,6 @@ From: nvidia/cuda:10.2-devel-ubuntu18.04
python3-virtualenv \
rsync \
ssh \
texlive \
texlive-latex-recommended \
texlive-pictures \
texlive-publishers \
texlive-science \
dvipng \
vim-nox \
virtualenv \
voro++-dev \