Skip to content

Commit

Permalink
Merge branch 'master' into weekly-build
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpvandermause authored Sep 20, 2024
2 parents 9d9ce8b + 060248e commit c582a7e
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 287 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/flare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
cmake ..
cmake --build . -j4
cp _C_flare* ../flare/bffs/sgp
cd ctests
./tests
Expand Down Expand Up @@ -89,8 +88,7 @@ jobs:
- name: Pip install
run: |
pip install -U codecov pytest pytest-cov pytest_mock Sphinx sphinx-rtd-theme breathe nbsphinx
pip install -r requirements.txt
pip install -e .[docs,tests]
- name: Patch ASE
run: |
Expand Down Expand Up @@ -121,11 +119,6 @@ jobs:
python tutorial.py
rm Al* aluminum.txt aspirin.txt md17_aspirin.npz tutorial.ipynb tutorial.py
- name: Install Sphinx and Breathe
run: |
sudo apt-get update
sudo apt-get install python3-sphinx python3-sphinx-rtd-theme python3-breathe python3-nbsphinx
- name: Run Doxygen
uses: mattnotmitt/[email protected]
with:
Expand All @@ -134,6 +127,7 @@ jobs:

- name: Run Sphinx
run: |
sudo apt-get install pandoc
export PYTHONPATH=$PYTHONPATH:$PWD/lammps/python
cd docs
pwd
Expand Down
76 changes: 26 additions & 50 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14.5)
cmake_minimum_required(VERSION 3.18...3.26)

set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
Expand All @@ -15,8 +15,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_OSX_ARCHITECTURES "x86_64")

set(FLARE_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling modules")

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "[flare] CMAKE_BUILD_TYPE not specified, setting it to "
"Release. Use `-DCMAKE_BUILD_TYPE=...` to overwrite.")
Expand All @@ -32,13 +30,15 @@ include(FetchContent)
# googletest
################################################################################

FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/External/googletest
UPDATE_COMMAND ""
)
FetchContent_MakeAvailable(googletest)
if(NOT DEFINED SKBUILD)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/External/googletest
UPDATE_COMMAND ""
)
FetchContent_MakeAvailable(googletest)
endif()

# Json
################################################################################
Expand All @@ -53,19 +53,6 @@ FetchContent_Populate(json)
add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR})
include_directories(${json_SOURCE_DIR})

# Kokkos
################################################################################

#FetchContent_Declare(kokkos
# GIT_REPOSITORY https://github.com/kokkos/kokkos
# SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/External/kokkos
# UPDATE_COMMAND ""
#)
#FetchContent_GetProperties(kokkos)
#FetchContent_Populate(kokkos)
#add_subdirectory(${kokkos_SOURCE_DIR} ${kokkos_BINARY_DIR})
#include_directories(${Kokkos_SOURCE_DIR})


# Eigen3
################################################################################
Expand Down Expand Up @@ -140,37 +127,24 @@ add_dependencies(flare eigen_project)
# Link to json.
target_link_libraries(flare PUBLIC nlohmann_json::nlohmann_json)

# Add conda include directories
if (DEFINED ENV{CONDA_PREFIX})
message(STATUS "Adding conda include directories.")
include_directories($ENV{CONDA_PREFIX}/include)
endif()

# Link to OpenMP.
if (DEFINED ENV{OMP_LOC})
target_link_libraries(flare PUBLIC $ENV{OMP_LOC})
message(STATUS "Linking to user-specified OpenMP library.")
elseif(DEFINED ENV{NO_OMP})
message(STATUS "Building without OpenMP.")
else()
if(NOT DEFINED ENV{NO_OMP})
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(flare PUBLIC OpenMP::OpenMP_CXX)
endif()
endif()

# Check for user-specified MKL package.
if (DEFINED ENV{MKL_INCLUDE} AND DEFINED ENV{MKL_LIBS})
message(STATUS "Linking Eigen to user-specified MKL libraries.")
include_directories($ENV{MKL_INCLUDE})
target_link_libraries(flare PUBLIC $ENV{MKL_LIBS})
target_compile_definitions(flare PUBLIC EIGEN_USE_MKL_ALL=1)
# Give the option to do a "bare-bones" build without Lapack/Lapacke.
elseif(DEFINED ENV{NO_LAPACK})
message(STATUS "Building without Lapack.")
else()
# Add conda include directories TODO: MKL issue if not
if(DEFINED ENV{CONDA_PREFIX})
message(STATUS "Adding conda include directories.")
include_directories($ENV{CONDA_PREFIX}/include)
endif()


if(NOT DEFINED ENV{NO_LAPACK})
find_package(LAPACK REQUIRED)
target_link_libraries(flare PUBLIC ${LAPACK_LIBRARIES})
target_link_libraries(flare PUBLIC LAPACK::LAPACK)

if (LAPACK_LIBRARIES MATCHES mkl)
message(STATUS "Linking Eigen to MKL.")
Expand All @@ -179,16 +153,18 @@ else()
find_package(LAPACKE)
if(LAPACKE_FOUND)
target_link_libraries(flare PUBLIC ${LAPACKE_LIBRARIES})
message(STATUS "Linking Eigen to LAPACKE.")
target_compile_definitions(flare PUBLIC EIGEN_USE_LAPACKE=1)
endif()
message(STATUS "Linking Eigen to LAPACKE.")
target_compile_definitions(flare PUBLIC EIGEN_USE_LAPACKE=1)
endif()
endif()

# Create pybind module.
pybind11_add_module(flare_module ${PYBIND_SOURCES})
target_link_libraries(flare_module PUBLIC flare)
set_target_properties(flare_module PROPERTIES OUTPUT_NAME "_C_flare")
install(TARGETS flare_module LIBRARY DESTINATION flare/bffs/sgp)

# Add test directory.
add_subdirectory(ctests)
if(NOT DEFINED SKBUILD)
add_subdirectory(ctests)
endif()
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion flare/descriptors/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def setup_mask(self, cutoffs_mask):
self.cut3b_mask = cutoffs_mask.get("cut3b_mask", None)
if "threebody_cutoff_list" in cutoffs_mask:
self.threebody_cutoff_list = np.array(
cutoffs_mask["threebody_cutoff_list"], dtype=np.float
cutoffs_mask["threebody_cutoff_list"], dtype=np.float64
)

def compute_env(self):
Expand Down
2 changes: 1 addition & 1 deletion flare/utils/parameter_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def summarize_group(self, group_type):
for ele in self.groups["specie"][idt]:
atom_n = atomic_numbers[ele]
if atom_n >= len(self.species_mask):
new_mask = np.ones(atom_n, dtype=np.int) * (nspecie - 1)
new_mask = np.ones(atom_n, dtype=np.int8) * (nspecie - 1)
new_mask[: len(self.species_mask)] = self.species_mask
self.species_mask = new_mask
self.species_mask[atom_n] = idt
Expand Down
4 changes: 2 additions & 2 deletions flare/utils/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def check_instantiation(hyps, cutoffs, kernels, param_dict):

# check mask has the right dimension and values
mask = param_dict[f"{kernel}_mask"]
param_dict[f"{kernel}_mask"] = nparray(mask, dtype=np.int)
param_dict[f"{kernel}_mask"] = nparray(mask, dtype=np.int8)

assert npmax(mask) < n
dim = Parameters.ndim[kernel]
Expand Down Expand Up @@ -247,7 +247,7 @@ def check_instantiation(hyps, cutoffs, kernels, param_dict):

# Ensure typed correctly as numpy array
param_dict["original_hyps"] = nparray(
param_dict["original_hyps"], dtype=np.float
param_dict["original_hyps"], dtype=np.float64
)
if (len(param_dict["original_hyps"]) - 1) not in param_dict["map"]:
assert (
Expand Down
60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[build-system]
requires = ["scikit-build-core", "pybind11"]
build-backend = "scikit_build_core.build"

[project]
name = "mir-flare"
version = "1.4.2"
description = "Fast Learning of Atomistic Rare Events"
readme = "README.md"
requires-python = ">=3.7"
authors = [
{ name = "Materials Intelligence Research", email = "[email protected]" },
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"ase==3.22",
"nptyping",
"numba",
"numpy",
"pyyaml",
"scipy",
"wandb",
]

[project.scripts]
flare-otf = "flare.scripts.otf_train:main"

[project.urls]
Homepage = "https://github.com/mir-group/flare"

[project.optional-dependencies]
tests = [
"pytest-mock",
"pytest>=4.6",
"IPython",
]
dev = [
"jupyter",
"memory_profiler",
]
docs = [
"babel",
"docutils==0.17.1",
"nbconvert",
"nbsphinx",
"pandoc",
"pygments==2.15.0",
"codecov",
"Sphinx",
"sphinx-rtd-theme",
"breathe"
]

[tool.scikit-build]
wheel.packages = ["flare"]
20 changes: 0 additions & 20 deletions requirements.txt

This file was deleted.

Loading

0 comments on commit c582a7e

Please sign in to comment.