Skip to content

Commit

Permalink
Merge remote-tracking branch 'v2/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjgowers committed Jul 16, 2024
2 parents fb38017 + b66b906 commit 7338117
Show file tree
Hide file tree
Showing 16 changed files with 3,463 additions and 0 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/make_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: build_and_test

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# 3 am Tuesdays and Fridays
- cron: 0 3 * * 2,5

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

defaults:
run:
shell: bash -l {0}

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.worfklow }}
cancel-in-progress: true

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda_envs/distopia_${{ matrix.os }}.yaml
environment-name: distopia
create-args: >-
python==${{ matrix.python-version }}
- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: python setup.py build

- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia


pip-install:
# A pure Python install, which relies purely on pyproject.toml contents
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# for now windows pip install builds seem to fail for some reason
os: [ubuntu-latest, macos-13]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: check_env
run: |
which python
python -m pip list
- name: build
run: python -m pip install . -vvv

- name: test
run: ctest --test-dir _skbuild/*/cmake-build/libdistopia

- name: install_pytest
run: pip install pytest

- name: python_test
# run python API tests
run: pytest distopia/tests
15 changes: 15 additions & 0 deletions devtools/conda_envs/distopia_macos-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: distopia
channels:
- conda-forge
dependencies:
- cmake
- make
- pip
- python >= 3.9
- cython
- numpy
- ninja
- pytest
- scikit-build
- compilers
- libxcrypt
15 changes: 15 additions & 0 deletions devtools/conda_envs/distopia_ubuntu-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: distopia
channels:
- conda-forge
dependencies:
- cmake
- make
- pip
- python >= 3.9
- cython
- numpy
- ninja
- pytest
- scikit-build
- compilers
- libxcrypt
14 changes: 14 additions & 0 deletions devtools/conda_envs/distopia_windows-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: distopia
channels:
- conda-forge
dependencies:
- cmake
- make
- pip
- python >= 3.9
- cython
- numpy
- ninja
- pytest
- scikit-build
- compilers
1 change: 1 addition & 0 deletions libdistopia/googlebench
Submodule googlebench added at ca8d0f
1 change: 1 addition & 0 deletions libdistopia/googletest
Submodule googletest added at 2dd1c1
1 change: 1 addition & 0 deletions libdistopia/highway
Submodule highway added at 457c89
39 changes: 39 additions & 0 deletions libdistopia/include/distopia.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Created by richard on 13/08/23.
//

#include <vector>
#include <string>

#ifndef DISTOPIA2_THE_HIGHWAY_WARRIOR_DISTOPIA_H
#define DISTOPIA2_THE_HIGHWAY_WARRIOR_DISTOPIA_H


// set EMU 128 to broken so that HWY_SCALAR is the baseline dispatch target
#define HWY_BROKEN_EMU128 1
// compile all attainable targets
#define HWY_COMPILE_ALL_ATTAINABLE


namespace distopia {
template <typename T> void CalcBondsNoBox(const T *a, const T *b, int n, T *out);
template <typename T> void CalcBondsOrtho(const T *a, const T *b, int n, const T *box, T *out);
template <typename T> void CalcBondsTriclinic(const T *a, const T *b, int n, const T *box, T *out);
template <typename T> void CalcAnglesNoBox(const T *a, const T *b, const T *c, int n, T *out);
template <typename T> void CalcAnglesOrtho(const T *a, const T *b, const T *c, int n, const T *box, T *out);
template <typename T> void CalcAnglesTriclinic(const T *a, const T *b, const T *c, int n, const T *box, T *out);
template <typename T> void CalcDihedralsNoBox(const T *a, const T *b, const T *c, const T *d, int n, T *out);
template <typename T> void CalcDihedralsOrtho(const T *a, const T *b, const T *c, const T *d, int n, const T *box, T *out);
template <typename T> void CalcDihedralsTriclinic(const T *a, const T *b, const T *c, const T *d, int n, const T *box, T *out);
template <typename T> void CalcDistanceArrayNoBox(const T *a, const T *b, int na, int nb, T *out);
template <typename T> void CalcDistanceArrayOrtho(const T *a, const T *b, int na, int nb, const T *box, T *out);
template <typename T> void CalcDistanceArrayTriclinic(const T *a, const T *b, int na, int nb, const T *box, T *out);
template <typename T> void CalcSelfDistanceArrayNoBox(const T *a, int n, T *out);
template <typename T> void CalcSelfDistanceArrayOrtho(const T *a, int n, const T *box, T *out);
template <typename T> void CalcSelfDistanceArrayTriclinic(const T *a, int n, const T *box, T *out);
int GetNFloatLanes();
int GetNDoubleLanes();
std::vector<std::string> DistopiaSupportedAndGeneratedTargets();
}

#endif //DISTOPIA2_THE_HIGHWAY_WARRIOR_DISTOPIA_H
Loading

0 comments on commit 7338117

Please sign in to comment.