From 0774e92ecea9aeaed8a8f0ad1cea7cc635f44224 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Aug 2019 06:40:31 -0400 Subject: [PATCH 1/5] use KIM-API 2.1.2 consistently with CMake and conventional build system --- lib/kim/Install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kim/Install.py b/lib/kim/Install.py index de22950639..836b5ba205 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -18,7 +18,7 @@ parser = ArgumentParser(prog='Install.py', # settings thisdir = fullpath('.') -version = "kim-api-2.1.1" +version = "kim-api-2.1.2" # help message From faefcc776a70b490ee70c2522c5c2d99c6322ec4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Aug 2019 10:38:41 -0400 Subject: [PATCH 2/5] sched_getaffinity() is a Linux specific system call. add preprocessor guards --- src/USER-INTEL/verlet_lrt_intel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/USER-INTEL/verlet_lrt_intel.cpp b/src/USER-INTEL/verlet_lrt_intel.cpp index 2b28eea3a2..a3c05c46bc 100644 --- a/src/USER-INTEL/verlet_lrt_intel.cpp +++ b/src/USER-INTEL/verlet_lrt_intel.cpp @@ -102,18 +102,20 @@ void VerletLRTIntel::setup(int flag) } #if defined(_LMP_INTEL_LRT_PTHREAD) + #if defined(__linux) if (comm->me == 0) { cpu_set_t cpuset; sched_getaffinity(0, sizeof(cpuset), &cpuset); int my_cpu_count = CPU_COUNT(&cpuset); if (my_cpu_count < comm->nthreads + 1) { char str[128]; - sprintf(str,"Using %d threads per MPI, but only %d core(s) allocated" - " per MPI", + sprintf(str,"Using %d threads per MPI rank, but only %d core(s)" + " allocated for each MPI rank", comm->nthreads + 1, my_cpu_count); error->warning(FLERR, str); } } + #endif _kspace_ready = 0; _kspace_done = 0; From 5b3423c60eb48444f959fe63d5e03ec6b09c0571 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Aug 2019 11:16:14 -0400 Subject: [PATCH 3/5] tweaks for Linux to Windows cross-compilation --- cmake/CMakeLists.txt | 1 + cmake/presets/mingw-cross.cmake | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 187b41e980..fd4cd51662 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -229,6 +229,7 @@ if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) enable_language(Fortran) file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF]) add_library(linalg STATIC ${LAPACK_SOURCES}) + set(BLAS_LIBRARIES linalg) set(LAPACK_LIBRARIES linalg) else() list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index b53e5a7b93..2ac24490bc 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -3,9 +3,9 @@ set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD - USER-MEAMC USER-MESO USER-MISC USER-MOFFF USER-MOLFILE USER-OMP - USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SDPD USER-SMD - USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-YAFF) + USER-MEAMC USER-MESO USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE + USER-OMP USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SDPD + USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-YAFF) foreach(PKG ${WIN_PACKAGES}) set(PKG_${PKG} ON CACHE BOOL "" FORCE) @@ -14,4 +14,3 @@ endforeach() set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) -set(INTEL_LRT_MODE "none" CACHE STRING "" FORCE) From d82ae64d16778523fb0460b4ac3894cf6ffd01dd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Aug 2019 11:16:55 -0400 Subject: [PATCH 4/5] minor tweak for consistency --- src/info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.cpp b/src/info.cpp index 21297c52c6..caa2d6fdd0 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -60,7 +60,7 @@ #include #endif -#if defined __linux +#if defined(__linux) #include #endif From 58d27403f15fc8e0e92bfa8f73f5665dd08a2753 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Aug 2019 18:28:26 -0400 Subject: [PATCH 5/5] CMake tweaks to improve building LAMMPS for windows with mingw on Linux --- cmake/CMakeLists.txt | 29 +++++++++++++++++++++++++---- cmake/presets/mingw-cross.cmake | 3 +++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fd4cd51662..e961fe25d3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -133,6 +133,24 @@ foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES}) option(PKG_${PKG} "Build ${PKG} Package" OFF) endforeach() +###################################################### +# download and unpack support binaries for compilation +# of windows binaries. +###################################################### +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(LAMMPS_THIRDPARTY_URL "http://download.lammps.org/thirdparty") + file(DOWNLOAD "${LAMMPS_THIRDPARTY_URL}/opencl-win-devel.tar.gz" "${CMAKE_CURRENT_BINARY_DIR}/opencl-win-devel.tar.gz" + EXPECTED_MD5 2c00364888d5671195598b44c2e0d44d) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf opencl-win-devel.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") + set(OpenCL_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win32/libOpenCL.dll") + elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") + set(OpenCL_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/lib_win64/libOpenCL.dll") + endif() + set(OpenCL_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/OpenCL/include") +endif() + +###################################################### ###################################################### # packages with special compiler needs or external libs ###################################################### @@ -148,6 +166,7 @@ if(PKG_USER-ADIOS) endif() # do MPI detection after language activation, if MPI for these language is required +set(MPI_CXX_SKIP_MPICXX TRUE) find_package(MPI QUIET) option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) if(BUILD_MPI) @@ -175,11 +194,13 @@ add_definitions(-DLAMMPS_${LAMMPS_SIZES}) set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_${LAMMPS_SIZES}") # posix_memalign is not available on Windows -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(LAMMPS_MEMALIGN "0" CACHE STRING "posix_memalign() is not available on Windows" FORCE) +else() set(LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS. Set to 0 to disable") - if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0") - add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) - endif() +endif() +if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0") + add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN}) endif() option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 2ac24490bc..fbec42529f 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -13,4 +13,7 @@ endforeach() set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE) set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE) +set(WITH_GZIP ON CACHE BOOL "" FORCE) +set(WITH_FFMPEG ON CACHE BOOL "" FORCE) set(LAMMPS_MEMALIGN "0" CACHE STRING "" FORCE) +set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lammps-installer")