User Tools

Site Tools


cluster:232


Back

Lampy

This is a fantastic forehead bang-on-desk exercise. So many applications wrapped together it is an enormous puzzle. I was greatly helped by following a recipe of student Max of the Starr Lab. Hopefully Max can report some performance results later as that was the driver to do this.

Lampy; I guess Lammps powered by Python. I should have gone with Lammpy :-?

Below is the adapted system wide install following Max's recipe. (I could not make the standalone work so we go with virtual env setup).

  • module; lammps/28Jan2026 (just for “show” module, you must source the lampy python venv in your shell)
# from OpenHPC env
  module load miniconda3/py39
  module load cmake/3.21.3

# get repo
  cd /share/apps/CENTOS8/ohpc/software/lammps
  git clone -b release https://github.com/lammps/lammps.git 28Jan2026
  cd 28Jan2026

 # create virtual env
 mkdir lampy
# do this once
 python -m venv $PWD/lampy
# do this every time
 source $PWD/lampy/bin/activate

  mkdir build
  cd build

# had to add the fPIC arg to cmake
  cmake -DCMAKE_POSITION_INDEPENDENT_CODE=On \
     ../cmake -DPKG_MOLECULE=yes \
     -DPKG_PYTHON=on \
     -DBUILD_SHARED_LIBS=yes

 -- <<< Build configuration >>>
   LAMMPS Version:   2025.12.10.0 patch_10Dec2025
   Operating System: Linux Rocky 8.10
   CMake Version:    3.21.3
   Build type:       RelWithDebInfo
   Install path:     /zfshomes/hmeij/.local
   Generator:        Unix Makefiles using /usr/bin/gmake
-- Enabled packages: MOLECULE;PYTHON
-- <<< Compilers and Flags: >>>
-- C++ Compiler:     /opt/ohpc/pub/compiler/gcc/9.4.0/bin/c++
      Type:          GNU
      Version:       9.4.0
      C++ Standard:  17
      C++ Flags:     -O2 -g -DNDEBUG
      Defines:       LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_OMP_COMPAT=4;LAMMPS_JPEG;LAMMPS_PNG;LAMMPS_GZIP;LAMMPS_FFMPEG;LMP_PYTHON
-- C compiler:       /opt/ohpc/pub/compiler/gcc/9.4.0/bin/gcc
      Type:          GNU
      Version:       9.4.0
      C Flags:       -O2 -g -DNDEBUG
-- <<< Linker flags: >>>
-- Executable name:  lmp
-- Shared library flags:
-- <<< MPI flags >>>
-- MPI_defines:      MPICH_SKIP_MPICXX;OMPI_SKIP_MPICXX;_MPICC_H
-- MPI includes:     /zfshomes/apps/CENTOS8/ohpc/software/miniconda3/py39/include;/share/apps/CENTOS8/ohpc/software/miniconda3/py39/include
-- MPI libraries:    /share/apps/CENTOS8/ohpc/software/miniconda3/py39/lib/libmpi.so;
-- Configuring done

# next
make

[100%] Linking CXX shared library liblammps.so
[100%] Built target lammps
[100%] Building CXX object CMakeFiles/lmp.dir/share/apps/CENTOS8/ohpc/software/lammps/28Jan2026/src/main.cpp.o
[100%] Linking CXX executable lmp
[100%] Built target lmp

# libs and executable
(lampy) [hmeij@cottontail2 build]$ ls
CMakeCache.txt  cmake_install.cmake  includes            LAMMPSConfigVersion.cmake  liblammps.so    lmp       styles
CMakeFiles      etc                  LAMMPSConfig.cmake  liblammps.pc               liblammps.so.0  Makefile

(lampy) [hmeij@cottontail2 build]$ ls -lh lmp
-rwxr-xr-x 1 hmeij its 842K Jan 29 15:16 lmp

# next
(lampy) [hmeij@cottontail2 build]$ which python
/share/apps/CENTOS8/ohpc/software/lammps/28Jan2026/lampy/bin/python

# make sure this version of python has what it needs for next step
python -m ensurepip --upgrade
python -m pip install --upgrade pip setuptools wheel
cmake . -DPython_EXECUTABLE=$(which python)

# finally
make install-python

Successfully built lammps-2025.12.10-cp39-cp39-linux_x86_64.whl
Installing wheel into virtual environment
Processing ./lammps-2025.12.10-cp39-cp39-linux_x86_64.whl
Installing collected packages: lammps
Successfully installed lammps-2025.12.10
Built target install-python

# Test on head node (where it was compiled) and random compute node
# Don't forget to load python module and source lampy env!

python
>>> from lammps import lammps
>>> L = lammps()
LAMMPS (10 Dec 2025)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread.
  using 1 OpenMP thread(s) per MPI task
>>>


Back

cluster/232.txt · Last modified: by hmeij07