add tests whether simple examples for coupling to the LAMMPS library can run
This commit is contained in:
@ -37,11 +37,11 @@ set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||
|
||||
##########################
|
||||
|
||||
add_executable(simple simple.c liblammpsplugin.c)
|
||||
target_link_libraries(simple PRIVATE MPI::MPI_C)
|
||||
target_compile_definitions(simple PRIVATE LAMMPS_LIB_MPI)
|
||||
add_executable(simple-plugin simple.c liblammpsplugin.c)
|
||||
target_link_libraries(simple-plugin PRIVATE MPI::MPI_C)
|
||||
target_compile_definitions(simple-plugin PRIVATE LAMMPS_LIB_MPI)
|
||||
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(simple PRIVATE ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(simple-plugin PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
@ -13,7 +13,7 @@ like below.
|
||||
|
||||
mpicc -c -O -DLAMMPS_LIB_MPI -Wall -g liblammpsplugin.c
|
||||
mpicc -c -O -DLAMMPS_LIB_MPI -Wall -g simple.c
|
||||
mpicc simple.o liblammpsplugin.o -ldl -o simpleC
|
||||
mpicc simple.o liblammpsplugin.o -ldl -o simple-plugin
|
||||
|
||||
or using the provided CMake file with:
|
||||
|
||||
@ -36,14 +36,14 @@ cd build-shared
|
||||
cmake -D BUILD_MPI=on -D BUILD_SHARED_LIBS=on ../cmake
|
||||
make
|
||||
|
||||
You then run simpleC on a parallel machine
|
||||
You then run simple-plugin on a parallel machine
|
||||
on some number of processors Q with 3 arguments:
|
||||
|
||||
% mpirun -np Q simpleC P in.lj $HOME/lammps/src/liblammps.so
|
||||
% mpirun -np Q simple-plugin P in.lj $HOME/lammps/src/liblammps.so
|
||||
|
||||
or
|
||||
|
||||
% mpirun -np Q simpleC P in.lj $HOME/lammps/build-shared/liblammps.so
|
||||
% mpirun -np Q simple-plugin P in.lj $HOME/lammps/build-shared/liblammps.so
|
||||
|
||||
P is the number of procs you want LAMMPS to run on (must be <= Q) and
|
||||
in.lj is a LAMMPS input script and the last argument is the path to
|
||||
|
||||
Reference in New Issue
Block a user