Skip to content

Commit

Permalink
Merge pull request lammps#4304 from akohlmey/collected-small-changes
Browse files Browse the repository at this point in the history
Add lammps_extract_atom_size() call to library interface and equivalent to python and fortran modules
  • Loading branch information
akohlmey authored Sep 3, 2024
2 parents 05e836f + 731847b commit 9243959
Show file tree
Hide file tree
Showing 34 changed files with 973 additions and 256 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/check-vla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# GitHub action to build LAMMPS on Linux with gcc and -Werror=vla
name: "Check for Variable Length Arrays"

on:
push:
branches:
- develop
pull_request:
branches:
- develop

workflow_dispatch:

jobs:
build:
name: Build with -Werror=vla
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: ubuntu-latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Install extra packages
run: |
sudo apt-get install -y ccache \
libeigen3-dev \
libgsl-dev \
libcurl4-openssl-dev \
mold \
mpi-default-bin \
mpi-default-dev \
ninja-build \
python3-dev
- name: Create Build Environment
run: mkdir build

- name: Set up ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: linux-vla-ccache-${{ github.sha }}
restore-keys: linux-vla-ccache-

- name: Building LAMMPS via CMake
shell: bash
run: |
ccache -z
python3 -m venv linuxenv
source linuxenv/bin/activate
python3 -m pip install numpy
python3 -m pip install pyyaml
cmake -S cmake -B build \
-C cmake/presets/most.cmake \
-D CMAKE_CXX_COMPILER=g++ \
-D CMAKE_C_COMPILER=gcc \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_CXX_FLAGS_DEBUG="-Og -g -Werror=vla" \
-D DOWNLOAD_POTENTIALS=off \
-D BUILD_MPI=on \
-D BUILD_SHARED_LIBS=off \
-D BUILD_TOOLS=off \
-D ENABLE_TESTING=off \
-D MLIAP_ENABLE_ACE=on \
-D MLIAP_ENABLE_PYTHON=off \
-D PKG_AWPMD=on \
-D PKG_GPU=on \
-D GPU_API=opencl \
-D PKG_LATBOLTZ=on \
-D PKG_MDI=on \
-D PKG_MANIFOLD=on \
-D PKG_ML-PACE=on \
-D PKG_ML-RANN=off \
-D PKG_MOLFILE=on \
-D PKG_RHEO=on \
-D PKG_PTM=on \
-D PKG_PYTHON=on \
-D PKG_QTB=on \
-D PKG_SMTBQ=on \
-G Ninja
cmake --build build
ccache -s
45 changes: 26 additions & 19 deletions .github/workflows/compile-msvc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# GitHub action to build LAMMPS on Windows with Visual C++
name: "Native Windows Compilation and Unit Tests"
name: "Windows Unit Tests"

on:
push:
Expand All @@ -16,43 +16,50 @@ jobs:
name: Windows Compilation Test
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: windows-latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Enable MSVC++
uses: lammps/setup-msvc-dev@v3
with:
arch: x64

- name: Install Ccache
run: |
choco install ccache ninja -y
- name: Set up ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: win-unit-ccache-${{ github.sha }}
restore-keys: win-unit-ccache-

- name: Select Python version
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Building LAMMPS via CMake
shell: bash
run: |
ccache -z
python3 -m pip install numpy
python3 -m pip install pyyaml
nuget install MSMPIsdk
nuget install MSMPIDIST
cmake -C cmake/presets/windows.cmake \
-D DOWNLOAD_POTENTIALS=off \
-D PKG_PYTHON=on \
-D WITH_PNG=off \
-D WITH_JPEG=off \
-S cmake -B build \
-D BUILD_SHARED_LIBS=on \
-D LAMMPS_EXCEPTIONS=on \
-D ENABLE_TESTING=on
cmake --build build --config Release --parallel 2
cmake -C cmake\presets\windows.cmake -D CMAKE_CXX_COMPILER=cl -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_C_COMPILER=cl -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_Fortran_COMPILER="" -D DOWNLOAD_POTENTIALS=off -D PKG_PYTHON=on -D WITH_PNG=off -D WITH_JPEG=off -S cmake -B build -D BUILD_SHARED_LIBS=on -D ENABLE_TESTING=on -D CMAKE_BUILD_TYPE=Release -G Ninja
cmake --build build
ccache -s
- name: Run LAMMPS executable
shell: bash
run: |
./build/Release/lmp.exe -h
./build/Release/lmp.exe -in bench/in.lj
build\lmp.exe -h
build\lmp.exe -in bench\in.lj
- name: Run Unit Tests
working-directory: build
shell: bash
run: ctest -V -C Release -E FixTimestep:python_move_nve
run: ctest -V -E FixTimestep:python_move_nve
82 changes: 82 additions & 0 deletions .github/workflows/unittest-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# GitHub action to build LAMMPS on Linux and run standard unit tests
name: "Unittest for Linux /w LAMMPS_BIGBIG"

on:
push:
branches:
- develop
pull_request:
branches:
- develop

workflow_dispatch:

jobs:
build:
name: Linux Unit Test
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: ubuntu-latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Install extra packages
run: |
sudo apt-get install -y ccache \
libeigen3-dev \
libgsl-dev \
libcurl4-openssl-dev \
mold \
ninja-build \
python3-dev
- name: Create Build Environment
run: mkdir build

- name: Set up ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: linux-unit-ccache-${{ github.sha }}
restore-keys: linux-unit-ccache-

- name: Building LAMMPS via CMake
shell: bash
run: |
ccache -z
python3 -m venv linuxenv
source linuxenv/bin/activate
python3 -m pip install numpy
python3 -m pip install pyyaml
cmake -S cmake -B build \
-C cmake/presets/gcc.cmake \
-C cmake/presets/most.cmake \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D BUILD_SHARED_LIBS=on \
-D LAMMPS_SIZES=bigbig \
-D DOWNLOAD_POTENTIALS=off \
-D ENABLE_TESTING=on \
-D MLIAP_ENABLE_ACE=on \
-D MLIAP_ENABLE_PYTHON=off \
-D PKG_MANIFOLD=on \
-D PKG_ML-PACE=on \
-D PKG_ML-RANN=on \
-D PKG_RHEO=on \
-D PKG_PTM=on \
-D PKG_PYTHON=on \
-D PKG_QTB=on \
-D PKG_SMTBQ=on \
-G Ninja
cmake --build build
ccache -s
- name: Run Tests
working-directory: build
shell: bash
run: ctest -V
14 changes: 10 additions & 4 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,13 @@ if(BUILD_OMP)
if(CMAKE_VERSION VERSION_LESS 3.28)
get_filename_component(_exe "${CMAKE_CXX_COMPILER}" NAME)
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (_exe STREQUAL "crayCC"))
set(CMAKE_SHARED_LINKER_FLAGS_${BTYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BTYPE} -fopenmp")
set(CMAKE_STATIC_LINKER_FLAGS_${BTYPE} "${CMAKE_STATIC_LINKER_FLAGS_${BTYPE} -fopenmp")
set(CMAKE_SHARED_LINKER_FLAGS_${BTYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BTYPE}} -fopenmp")
set(CMAKE_STATIC_LINKER_FLAGS_${BTYPE} "${CMAKE_STATIC_LINKER_FLAGS_${BTYPE}} -fopenmp")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang")
set(CMAKE_SHARED_LINKER_FLAGS_${BTYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BTYPE} -fopenmp")
set(CMAKE_STATIC_LINKER_FLAGS_${BTYPE} "${CMAKE_STATIC_LINKER_FLAGS_${BTYPE} -fopenmp")
set(CMAKE_SHARED_LINKER_FLAGS_${BTYPE} "${CMAKE_SHARED_LINKER_FLAGS_${BTYPE}} -fopenmp")
set(CMAKE_STATIC_LINKER_FLAGS_${BTYPE} "${CMAKE_STATIC_LINKER_FLAGS_${BTYPE}} -fopenmp")
endif()
endif()
endif()
Expand Down Expand Up @@ -973,6 +973,9 @@ message(STATUS "<<< Compilers and Flags: >>>
C++ Standard: ${CMAKE_CXX_STANDARD}
C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}
Defines: ${DEFINES}")
if(CMAKE_CXX_COMPILER_LAUNCHER)
message(STATUS " Launcher: ${CMAKE_CXX_COMPILER_LAUNCHER}")
endif()
get_target_property(OPTIONS lammps COMPILE_OPTIONS)
if(OPTIONS)
message(" Options: ${OPTIONS}")
Expand All @@ -991,6 +994,9 @@ if(_index GREATER -1)
Type: ${CMAKE_C_COMPILER_ID}
Version: ${CMAKE_C_COMPILER_VERSION}
C Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}")
if(CMAKE_C_COMPILER_LAUNCHER)
message(STATUS " Launcher: ${CMAKE_C_COMPILER_LAUNCHER}")
endif()
endif()
message(STATUS "<<< Linker flags: >>>")
message(STATUS "Executable name: ${LAMMPS_BINARY}")
Expand Down
40 changes: 32 additions & 8 deletions doc/src/Build_development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,35 @@ The following target are available for both, GNU make and CMake:
GitHub command line interface
-----------------------------

GitHub is developing a `tool for the command line
<https://cli.github.com>`_ that interacts with the GitHub website via a
command called ``gh``. This can be extremely convenient when working
with a Git repository hosted on GitHub (like LAMMPS). It is thus highly
recommended to install it when doing LAMMPS development.

The capabilities of the ``gh`` command is continually expanding, so
please see the documentation at https://cli.github.com/manual/
GitHub has developed a `command line tool <https://cli.github.com>`_
to interact with the GitHub website via a command called ``gh``.
This is extremely convenient when working with a Git repository hosted
on GitHub (like LAMMPS). It is thus highly recommended to install it
when doing LAMMPS development. To use ``gh`` you must be within a git
checkout of a repository and you must obtain an authentication token
to connect your checkout with a GitHub user. This is done with the
command: ``gh auth login`` where you then have to follow the prompts.
Here are some examples:

.. list-table::
:header-rows: 1
:widths: 34 66

* - Command
- Description
* - ``gh pr list``
- List currently open pull requests
* - ``gh pr checks 404``
- Shows the status of all checks for pull request #404
* - ``gh pr view 404``
- Shows the description and recent comments for pull request #404
* - ``gh co 404``
- Check out the branch from pull request #404; set up for pushing changes
* - ``gh issue list``
- List currently open issues
* - ``gh issue view 430 --comments``
- Shows the description and all comments for issue #430

The capabilities of the ``gh`` command are continually expanding, so
for more details please see the documentation at https://cli.github.com/manual/
or use ``gh --help`` or ``gh <command> --help`` for embedded help.
6 changes: 6 additions & 0 deletions doc/src/Library_atoms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Per-atom properties
This section documents the following functions:

- :cpp:func:`lammps_extract_atom_datatype`
- :cpp:func:`lammps_extract_atom_size`
- :cpp:func:`lammps_extract_atom`

-----------------------
Expand All @@ -13,6 +14,11 @@ This section documents the following functions:

-----------------------

.. doxygenfunction:: lammps_extract_atom_size
:project: progguide

-----------------------

.. doxygenfunction:: lammps_extract_atom
:project: progguide

Loading

0 comments on commit 9243959

Please sign in to comment.