Closed kaustubhjsawant closed 2 years ago
Yes, it needs the -restrict
flag for proper compilation.
You can add the flag manually if you will be using Intel compilers.
diff --git a/hooks/lammps/CMakeLists.txt b/hooks/lammps/CMakeLists.txt
index dcc9998..c080a4f 100644
--- a/hooks/lammps/CMakeLists.txt
+++ b/hooks/lammps/CMakeLists.txt
@@ -187,6 +187,7 @@ ExternalProject_Add(
CCFLAGS+=-I${PROJECT_SOURCE_DIR}/include
CCFLAGS+=-std=c++11
CCFLAGS+=-O3
+ CCFLAGS+=-restrict
LIB+=$<TARGET_FILE:libssages>
INSTALL_COMMAND ""
BUILD_IN_SOURCE true
A more robust change would be something like this, that checks for Intel compilers and adds the flags if necessary.
@@ -176,6 +176,10 @@ foreach (PACKAGE ${LAMMPS_PACKAGES})
add_custom_target (no-${PACKAGE} $(MAKE) -C ${LAMMPS_SRC} no-${PACKAGE})
endforeach (PACKAGE ${LAMMPS_PACKAGES})
+if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ set(INTEL_FLAGS "CCFLAGS+=-restrict")
+endif ()
+
# Add lammps as external project
ExternalProject_Add(
lammps
@@ -187,6 +191,7 @@ ExternalProject_Add(
CCFLAGS+=-I${PROJECT_SOURCE_DIR}/include
CCFLAGS+=-std=c++11
CCFLAGS+=-O3
+ ${INTEL_FLAGS}
LIB+=$<TARGET_FILE:libssages>
INSTALL_COMMAND ""
BUILD_IN_SOURCE true
Thank you. The fix worked !
Kaustubh
Hello,
I am tryting to compile ssages with lammps_22Aug2018. However, I am not able to install with the opt package with intel compilers. The opt package has some issues with intel compilers and requires -restrict tag ( https://github.com/lammps/lammps/issues/610 ). I am not well versed with cmake but can someone help to figure out that the right makefile is being used to build lammps ? Just to clarify, I can build lammps standalone but ssages cant.
Error Message:
Thank you, Kaustubh