From 61ce73273b3290083c01e6a2fadfb3db0889b9ba Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 19 Sep 2020 22:27:21 -0400 Subject: [PATCH 1/4] Add missing -u flag for unbuffered PyLammps tests Addresses issue #2380 --- unittest/python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index 6082eb99b1..490314ca9d 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -37,7 +37,7 @@ if (Python_EXECUTABLE) set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u) endif() else() - set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE}) + set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u) endif() add_test(NAME PythonOpen From dfd447f5703c798cfba5821631cc172a49e01a54 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 19 Sep 2020 22:47:48 -0400 Subject: [PATCH 2/4] Add missing tools for PDF index build to containers --- tools/singularity/fedora32_mingw.def | 4 ++-- tools/singularity/ubuntu18.04.def | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/singularity/fedora32_mingw.def b/tools/singularity/fedora32_mingw.def index fa0227c4e3..68ad7b2a59 100644 --- a/tools/singularity/fedora32_mingw.def +++ b/tools/singularity/fedora32_mingw.def @@ -30,12 +30,12 @@ From: fedora:32 mingw32-expat mingw64-expat \ mingw64-expat-static mingw32-expat-static \ mingw32-sqlite-static mingw64-sqlite-static \ - enchant python3-virtualenv doxygen \ + enchant python3-virtualenv doxygen latexmk \ texlive-latex-fonts texlive-pslatex texlive-collection-latexrecommended \ texlive-latex texlive-latexconfig doxygen-latex texlive-collection-latex \ texlive-latex-bin texlive-lualatex-math texlive-fncychap texlive-tabulary \ texlive-framed texlive-wrapfig texlive-upquote texlive-capt-of \ - texlive-needspace texlive-titlesec texlive-anysize texlive-dvipng \ + texlive-needspace texlive-titlesec texlive-anysize texlive-dvipng texlive-xindy \ blas-devel lapack-devel libyaml-devel openkim-models kim-api-devel \ zstd libzstd-devel dnf clean all diff --git a/tools/singularity/ubuntu18.04.def b/tools/singularity/ubuntu18.04.def index 921000c326..54c750955b 100644 --- a/tools/singularity/ubuntu18.04.def +++ b/tools/singularity/ubuntu18.04.def @@ -64,6 +64,8 @@ From: ubuntu:18.04 texlive-publishers \ texlive-science \ dvipng \ + latexmk \ + xindy \ vim-nox \ virtualenv \ voro++-dev \ From 7d07d04989e0063c920e4ec08d2798f739375c7c Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 20 Sep 2020 17:52:24 -0400 Subject: [PATCH 3/4] Use correct library for unit test if LAMMPS_MACHINE_NAME is set --- unittest/python/python-open.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittest/python/python-open.py b/unittest/python/python-open.py index 2ace52296f..6ad7d335d5 100644 --- a/unittest/python/python-open.py +++ b/unittest/python/python-open.py @@ -12,7 +12,11 @@ except: pass try: - lmp = lammps() + if 'LAMMPS_MACHINE_NAME' in os.environ: + machine = os.environ['LAMMPS_MACHINE_NAME'] + else: + machine = "" + lmp = lammps(name=machine) has_mpi = lmp.has_mpi_support lmp.close() except: From acb5fd2ebf314ddfa3f18e76066eb8d83fbab8c0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 20 Sep 2020 18:16:25 -0400 Subject: [PATCH 4/4] Simplify GenerateBinaryHeader utility The function implementation was incomplete for handling the case of multiple files. It would generate wrong C code in case more than one files were specified. Since we don't have this use case, it's safe to only leave the single input file implementation. Closes issue #2294 --- cmake/Modules/GenerateBinaryHeader.cmake | 2 +- cmake/Modules/LAMMPSUtils.cmake | 16 ++++++---------- cmake/Modules/Packages/GPU.cmake | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cmake/Modules/GenerateBinaryHeader.cmake b/cmake/Modules/GenerateBinaryHeader.cmake index 512f69e09d..498a4f68f5 100644 --- a/cmake/Modules/GenerateBinaryHeader.cmake +++ b/cmake/Modules/GenerateBinaryHeader.cmake @@ -1,3 +1,3 @@ # utility script to call GenerateBinaryHeader function include(${SOURCE_DIR}/Modules/LAMMPSUtils.cmake) -GenerateBinaryHeader(${VARNAME} ${HEADER_FILE} ${SOURCE_FILES}) +GenerateBinaryHeader(${VARNAME} ${HEADER_FILE} ${SOURCE_FILE}) diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index a87c0f567c..339ba867bd 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -71,19 +71,15 @@ macro(pkg_depends PKG1 PKG2) endmacro() # CMake-only replacement for bin2c and xxd -function(GenerateBinaryHeader varname outfile files) +function(GenerateBinaryHeader varname outfile infile) message("Creating ${outfile}...") file(WRITE ${outfile} "// CMake generated file\n") - math(EXPR ARG_END "${ARGC}-1") - foreach(IDX RANGE 2 ${ARG_END}) - list(GET ARGV ${IDX} filename) - file(READ ${filename} content HEX) - string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," content "${content}") - string(REGEX REPLACE ",$" "" content "${content}") - file(APPEND ${outfile} "const unsigned char ${varname}[] = { ${content} };\n") - file(APPEND ${outfile} "const unsigned int ${varname}_size = sizeof(${varname});\n") - endforeach() + file(READ ${infile} content HEX) + string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," content "${content}") + string(REGEX REPLACE ",$" "" content "${content}") + file(APPEND ${outfile} "const unsigned char ${varname}[] = { ${content} };\n") + file(APPEND ${outfile} "const unsigned int ${varname}_size = sizeof(${varname});\n") endfunction(GenerateBinaryHeader) # fetch missing potential files diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index ac2c975da3..cad6e2bf9a 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -309,7 +309,7 @@ elseif(GPU_API STREQUAL "HIP") endif() add_custom_command(OUTPUT ${CUBIN_H_FILE} - COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D VARNAME=${CU_NAME} -D HEADER_FILE=${CUBIN_H_FILE} -D SOURCE_FILES=${CUBIN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateBinaryHeader.cmake + COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D VARNAME=${CU_NAME} -D HEADER_FILE=${CUBIN_H_FILE} -D SOURCE_FILE=${CUBIN_FILE} -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/GenerateBinaryHeader.cmake DEPENDS ${CUBIN_FILE} COMMENT "Generating ${CU_NAME}_cubin.h")