Skip to content

Commit

Permalink
update readme and some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Apr 4, 2024
1 parent d5919ef commit 4035e41
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 109 deletions.
106 changes: 23 additions & 83 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,9 @@ jobs:
strategy:
fail-fast: false
matrix:
cxx: [17, 20]
build_type: ["RelWithDebInfo"]
compiler:
[
"g++-11",
"g++-10",
"clang++-11",
"clang++-12",
"clang++-13",
"clang++-14"
]
name: "Ubuntu 22.04 (${{ matrix.compiler }}, C++${{ matrix.cxx }}, ${{matrix.build_type}})"
cxx: [20]
build_type: ["Release", "Debug"]
name: "Ubuntu 22.04 (C++${{ matrix.cxx }}, ${{matrix.build_type}})"
runs-on: ubuntu-22.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
Expand All @@ -43,71 +34,21 @@ jobs:
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2204_no_cuda-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}"
key: "ccache-ubuntu2204_no_cuda-${{ matrix.cxx }}-${{ matrix.build_type }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update

- name: Install GCC 11
if: ${{ startsWith(matrix.compiler, 'g++-11') }}
run: sudo apt install -y g++-11
- name: Install GCC 10
if: ${{ startsWith(matrix.compiler, 'g++-10') }}
run: sudo apt install -y g++-10
- name: Install Clang 11
if: ${{ startsWith(matrix.compiler, 'clang++-11') }}
run: sudo apt install -y clang-11
- name: Install Clang 12
if: ${{ startsWith(matrix.compiler, 'clang++-12') }}
run: sudo apt install -y clang-12
- name: Install Clang 13
if: ${{ startsWith(matrix.compiler, 'clang++-13') }}
run: sudo apt install -y clang-13
- name: Install Clang 14
if: ${{ startsWith(matrix.compiler, 'clang++-14') }}
run: sudo apt install -y clang-14

- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh all
- name: Check clang version
run: clang++ --version
- name: "Download dependencies"
run: sudo apt install cmake ninja-build
- name: "Cmake configure"
run: cmake --preset=prop-actions -S . -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
- name: "build "
run: cmake --build build/ --target "pyprop;prop_test" -- -j3

ubuntu_2004_cc_matrix_no_cuda:
strategy:
fail-fast: false
matrix:
cxx: [17]
build_type: ["RelWithDebInfo"]
compiler:
[
"g++",
"clang++"
]
name: "Ubuntu 20.04 (${{ matrix.compiler }}, C++${{ matrix.cxx }}, ${{matrix.build_type}})"
runs-on: ubuntu-20.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2004_no_cuda-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Install GCC
if: ${{ startsWith(matrix.compiler, 'g++') }}
run: sudo apt install -y g++
- name: Install Clang
if: ${{ startsWith(matrix.compiler, 'clang++') }}
run: sudo apt install -y clang
- name: "Download dependencies"
run: sudo apt install cmake ninja-build
- name: "Cmake configure"
run: cmake --preset=prop-actions -S . -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
run: cmake --preset=prop-actions -S . -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
- name: "build "
run: cmake --build build/ --target "pyprop;prop_test" -- -j3

Expand All @@ -116,16 +57,12 @@ jobs:
strategy:
fail-fast: false
matrix:
cxx: [17, 20]
build_type: ["Debug", "RelWithDebInfo"]
compiler:
[
"g++-11"
]
name: "Ubuntu 22.04 CUDA (${{ matrix.compiler }}, C++${{ matrix.cxx }}, ${{matrix.build_type}})"
cxx: [20]
build_type: ["Debug", "Release"]
name: "Ubuntu 22.04 CUDA (C++${{ matrix.cxx }}, ${{matrix.build_type}})"
runs-on: ubuntu-22.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
id: "(C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
steps:
- uses: actions/checkout@v3
- name: ccache
Expand All @@ -139,12 +76,15 @@ jobs:
cuda: '12.1.0'
- name: "update APT database"
run: sudo apt -q update
- name: Install GCC 11
if: ${{ startsWith(matrix.compiler, 'g++-11') }}
run: sudo apt install -y g++-11
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh all
- name: "Download dependencies"
run: sudo apt install cmake ninja-build
- name: "Cmake configure"
run: cmake --preset=prop-cuda-actions -S . -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
run: cmake --preset=prop-cuda-actions -S . -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
- name: "build "
run: cmake --build build/ --target "pyprop" -- -j3
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ FetchContent_MakeAvailable(spdlog)

# ---- Add Kokkos ----
# Kokkos::kokkos

FetchContent_Declare(
PyKokkosbase
GIT_REPOSITORY https://github.com/Yaraslaut/pykokkos-base.git
GIT_TAG ec5944a136d607a4b6fec36bb90dfcd11b36f877
GIT_REPOSITORY https://github.com/kokkos/pykokkos-base.git
GIT_TAG b8694f5986eeeb7aacbf5d75430e3d9caa986629
)
FetchContent_MakeAvailable(PyKokkosbase)
find_package(Python3 COMPONENTS Development)
Expand Down Expand Up @@ -95,6 +96,9 @@ if(Prop_USE_SPDLOG)
target_compile_definitions(prop_lib PUBLIC USE_SPDLOG)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(prop_lib PUBLIC "-O3")
endif()

target_link_libraries(prop_lib PUBLIC
${External_linked_libraries}
Expand Down
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"Kokkos_ENABLE_OPENMP": "OFF",
"CMAKE_CXX_STANDARD": "20",
"Kokkos_ENABLE_CUDA" : "ON"
}
},
Expand Down Expand Up @@ -134,6 +135,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"Kokkos_ENABLE_OPENMP": "ON",
"CMAKE_CXX_STANDARD": "20",
"Kokkos_ENABLE_CUDA" : "ON"
}
}
Expand Down
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
![](logo/logo.png)
# This project is still under heavy development

# prop

Expand All @@ -13,7 +12,7 @@ data.
Example command to build prop with openmp support, to compile with CUDA support, use `prop-cuda-debug` preset.

``` sh
cmake --preset=prop-openmp-debug
cmake --preset prop-openmp-debug
cmake --build build --target pyprop
```
IMPORTANT: please specify `target` when building `prop` otherwise compilation time will be extremely large.
Expand All @@ -32,21 +31,3 @@ python ./simple.py

```


## known issues
https://github.com/pybind/pybind11/issues/4606


https://github.com/kokkos/pykokkos-base/issues/55


https://github.com/NVIDIA/thrust/issues/1703


https://github.com/llvm/llvm-project/issues/57544


https://forums.developer.nvidia.com/t/strange-errors-after-system-gcc-upgraded-to-13-1-1/252441


https://github.com/pybind/pybind11/issues/314
8 changes: 6 additions & 2 deletions src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@ void System2D::addBlock(PMLRegionY& pml_block)
pml_block._entity_id = _max_entity_id;
const auto [x_offset, x_size, y_offset, y_size] = _geometry.getProperties(pml_block._box);

// OPENMP stuctured binding is not supported
auto x_offset_ = x_offset;
auto y_offset_ = y_offset;

auto policy = SimplePolicy2D({ 0, 0 }, { x_size, y_size });
auto entity_ind = _field._which_entity.view_host();
auto max_entity_ind = _max_entity_id;
_field._which_entity.sync_host();
Kokkos::parallel_for(
policy, KOKKOS_LAMBDA(const int& iinit, const int& jinit) {
const int i = iinit + x_offset;
const int j = jinit + y_offset;
const int i = iinit + x_offset_;
const int j = jinit + y_offset_;
entity_ind(i, j) = max_entity_ind;
});
pml_block._box._x.calcN(_space_step);
Expand Down
5 changes: 3 additions & 2 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
namespace Prop
{

constexpr double Const_pi = 3.14159265358979323846;
constexpr double Const_epsilon0 = 8.85418782 * 1e-12;
constexpr double Const_mu0 = 4.0 * Kokkos::numbers::pi * 1e-7;
constexpr double Const_mu0 = 4.0 * Const_pi * 1e-7;
constexpr double Const_c = 1.0; // 299792457.95971;
constexpr double Const_standard_courant_factor = 1.0; // 84853;
constexpr double Const_scaling_factor = 1.0; // 1e-6; // TODO
Expand Down Expand Up @@ -59,7 +60,7 @@ struct Types
{
using view_type = GridData2D_dual;

using memory_space = std::conditional<std::is_same<ExecutionSpace, Kokkos::DefaultExecutionSpace>::value,
using memory_space = typename std::conditional<std::is_same<ExecutionSpace, Kokkos::DefaultExecutionSpace>::value,
view_type::t_dev::memory_space,
view_type::t_host::memory_space>::type;

Expand Down

0 comments on commit 4035e41

Please sign in to comment.