기존 build디렉토리에 있는 install_manifest.txt를 이용해서 build install 먼저 제거
xargs sudo rm < install_manifest.txt
한 디렉토리 위로 가서 build 디렉토리 삭제
rm -rf build
이제 부터 다시 컴파일 준비
mkdir build
cd build
intel OneAPI를 쓸거니까, 환경변수를 세팅하고,
source /opt/intel/oneapi/setvars.sh
source /opt/intel/oneapi/mpi/latest/env/vars.sh
확인하고,
which icpx
/opt/intel/oneapi/compiler/2025.0/bin/icpx
which icx
/opt/intel/oneapi/compiler/2025.0/bin/icx
which ifx
/opt/intel/oneapi/compiler/2025.0/bin/ifx
which icpx
/opt/intel/oneapi/compiler/2025.0/bin/icpx
which mpiicx
/opt/intel/oneapi/mpi/2021.14/bin/mpiicx
Cmake 옵션설정, MPI와 OpenMP는 Default yes이다.
Intel OenAPI를 사용하기 위해서는 cmake옵션 보다는 lammps에서 제공하는 preset을 사용한다.
cmake ../cmake \
-D LAMMPS_MACHINE=1API_PKGintelGranular \
-D INTEL_ARCH=cpu \
-D INTEL_LRT_MODE=thread \
-D CMAKE_INSTALL_PREFIX=$HOME/LAMMPS_1API_PKGintelGranular \
-C ../cmake/presets/intel.cmake
Granular Package는 Optional Package로 분류된다.
https://docs.lammps.org/Packages_details.html
6.2. Package details — LAMMPS documentation
Here is a brief description of all packages in LAMMPS. It lists authors (if applicable) and summarizes the package contents. It has specific instructions on how to install the package, including, if necessary, info on how to download or build any extra lib
docs.lammps.org
소스코드에 GRANULAR옵션이 제대로 들어가 있는지 확인해보고,
$ ls src/GRANULAR
compute_contact_atom.cpp fix_wall_gran.cpp gran_sub_mod_tangential.cpp
compute_contact_atom.h fix_wall_gran.h gran_sub_mod_tangential.h
compute_fabric.cpp fix_wall_gran_region.cpp gran_sub_mod_twisting.cpp
compute_fabric.h fix_wall_gran_region.h gran_sub_mod_twisting.h
fix_add_heat.cpp gran_sub_mod.cpp granular_model.cpp
fix_add_heat.h gran_sub_mod_damping.cpp granular_model.h
fix_damping_cundall.cpp gran_sub_mod_damping.h pair_gran_hertz_history.cpp
fix_damping_cundall.h gran_sub_mod.h pair_gran_hertz_history.h
fix_freeze.cpp gran_sub_mod_heat.cpp pair_gran_hooke.cpp
fix_freeze.h gran_sub_mod_heat.h pair_gran_hooke.h
fix_heat_flow.cpp gran_sub_mod_normal.cpp pair_gran_hooke_history.cpp
fix_heat_flow.h gran_sub_mod_normal.h pair_gran_hooke_history.h
fix_pour.cpp gran_sub_mod_rolling.cpp pair_granular.cpp
fix_pour.h gran_sub_mod_rolling.h pair_granular.h
옵션 규칙은 아래와 같으므로,
-D PKG_<NAME>=on
최종 cmake 실행 옵션은
cmake ../cmake \
-D LAMMPS_MACHINE=1API_PKGintelGranular \
-D INTEL_ARCH=cpu \
-D INTEL_LRT_MODE=thread \
-D CMAKE_INSTALL_PREFIX=$HOME/LAMMPS_1API_PKGintelGranular \
-D PKG_GRANULAR=on \
-C ../cmake/presets/intel.cmake
대충 cmake는 잘 세팅된 듯
-- <<< Build configuration >>>
LAMMPS Version: 20240829 stable_29Aug2024_update1-26-g89e442dac1-modified
Operating System: Linux Ubuntu" 22.04
CMake Version: 3.22.1
Build type: RelWithDebInfo
Install path: /mnt/data_d/mylammps/build
Generator: Unix Makefiles using /usr/bin/gmake
-- Enabled packages: GRANULAR
-- <<< Compilers and Flags: >>>
-- C++ Compiler: /opt/intel/oneapi/compiler/2025.0/bin/icpx
Type: IntelLLVM
Version: 2025.0.4
C++ Standard: 11
C++ Flags: -Wall -Wextra -g -O2 -DNDEBUG
Defines: LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_CURL;LAMMPS_JPEG;LAMMPS_PNG;LAMMPS_GZIP;LAMMPS_FFMPEG
Options: -Wno-tautological-constant-compare;-Wno-unused-command-line-argument
-- <<< Linker flags: >>>
-- Executable name: lmp_1API_PKGintelGranular
-- Static library flags:
-- <<< MPI flags >>>
-- MPI_defines: MPICH_SKIP_MPICXX;OMPI_SKIP_MPICXX;_MPICC_H
-- MPI includes: /opt/intel/oneapi/mpi/2021.14/include
-- MPI libraries: /opt/intel/oneapi/mpi/2021.14/lib/libmpifort.so;/opt/intel/oneapi/mpi/2021.14/lib/libmpi.so;/lib/x86_64-linux-gnu/libdl.a;/lib/x86_64-linux-gnu/librt.a;/lib/x86_64-linux-gnu/libpthread.a;
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/data_d/mylammps/build
이제 make
make -j 4
make install
결과를 보면, build 디렉토리 아래 실행화일은 잘 만들어 졌으며, installation prefix도 제대로 지정되었다.
-- Installing: /home/hp-z8/LAMMPS_1API_PKGintelGranular/share/lammps/potentials/Ni_Zuo_JPCA2020.snapcoeff
-- Installing: /home/hp-z8/LAMMPS_1API_PKGintelGranular/etc/profile.d/lammps.sh
-- Installing: /home/hp-z8/LAMMPS_1API_PKGintelGranular/etc/profile.d/lammps.csh
hp-z8@HP-Z8:/mnt/data_d/mylammps/build$ ls
CMakeCache.txt cmake_install.cmake includes liblammps_1API_PKGintelGranular.a Makefile
CMakeFiles etc install_manifest.txt lmp_1API_PKGintelGranular styles
Granular package option 일단 성공
$ mpiexec -np 10 ./lmp_1API_PKGintelGranular -in lmp_test.in
LAMMPS (29 Aug 2024 - Maintenance - stable_29Aug2024_update1-26-g89e442dac1-modified)
'LAMMPS' 카테고리의 다른 글
KOKKOS Package (1) | 2024.12.24 |
---|---|
컴파일된 LAMMPS의 확인 (0) | 2024.12.24 |
Intel Package Compile (1) | 2024.12.21 |
VTK library compile w/ intel oneAPI (0) | 2024.12.12 |
INTEL and NVIDIA compile option (using CMAKE) (2) | 2024.12.03 |