Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating kernels #117

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust-version: ["stable"]
rust-version: ["stable", "nightly"]
mpi: ['mpich', 'openmpi']
steps:
- name: Set up Rust
Expand All @@ -34,28 +34,28 @@ jobs:
sudo apt-get install libopenblas-dev liblapack-dev
- name: Style checks
run: |
cargo fmt -- --check
cargo clippy -- -D warnings
cargo clippy --tests -- -D warnings
cargo clippy --examples -- -D warnings
cargo +${{ matrix.rust-version }} fmt -- --check
cargo +${{ matrix.rust-version }} clippy -- -D warnings
cargo +${{ matrix.rust-version }} clippy --tests -- -D warnings
cargo +${{ matrix.rust-version }} clippy --examples -- -D warnings

- name: Build rust library
run: cargo build --features "strict"
run: cargo +${{ matrix.rust-version }} build --features "strict"

- name: Run unit tests
run: cargo test --lib --features "strict"
run: cargo +${{ matrix.rust-version }} test --lib --features "strict"
- name: Run unit tests (with mpi enabled)
run: cargo test --lib --features "mpi,strict"
run: cargo +${{ matrix.rust-version }} test --lib --features "mpi,strict"
- name: Run tests
run: cargo test --examples --release --features "mpi,strict"
run: cargo +${{ matrix.rust-version }} test --examples --release --features "mpi,strict"
- name: Run examples
run: |
python3 find_examples.py
python3 find_examples.py --cargo-version ${{ matrix.rust-version }}
chmod +x examples.sh
./examples.sh

- name: Build docs
run: cargo doc --features "strict" --no-deps
run: cargo +${{ matrix.rust-version }} doc --features "strict" --no-deps

run-tests-python:
name: Run tests (Python)
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/run-weekly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,20 @@ jobs:
sudo apt-get install libopenblas-dev liblapack-dev

- name: Build rust library (debug)
run: cargo build --features "strict"
run: cargo +${{ matrix.rust-version }} build --features "strict"
- name: Build rust library (release)
run: cargo build --release --features "strict"
run: cargo +${{ matrix.rust-version }} build --release --features "strict"
- name: Build rust library (release with mpi)
run: cargo build --release --features "strict,mpi"
run: cargo +${{ matrix.rust-version }} build --release --features "strict,mpi"

- name: Run unit tests
run: cargo test --lib --features "strict"
run: cargo +${{ matrix.rust-version }} test --lib --features "strict"
- name: Run unit tests (with mpi enabled)
run: cargo test --lib --features "mpi,strict"
run: cargo +${{ matrix.rust-version }} test --lib --features "mpi,strict"
- name: Run tests
run: cargo test --examples --release --features "mpi,strict"
run: cargo +${{ matrix.rust-version }} test --examples --release --features "mpi,strict"
- name: Run examples
run: |
python3 find_examples.py
python3 find_examples.py --cargo-version ${{ matrix.rust-version }}
chmod +x examples.sh
./examples.sh

- name: Build docs
run: cargo doc --features "strict" --no-deps
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"bem",
"element",
"fmm",
"generation",
"grid",
"hyksort",
"quadrature",
Expand All @@ -17,6 +18,7 @@ default-members = [
"bem",
"element",
"fmm",
"generation",
"grid",
"hyksort",
"quadrature",
Expand Down
8 changes: 6 additions & 2 deletions find_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--features', default=None,
help='feature flags to pass to the examples')
parser.add_argument('--cargo-version', default="stable",
help='cargo version to use (stable/beta/nightly')

raw_features = parser.parse_args().features
a = parser.parse_args()
raw_features = a.features
cargo_version = a.cargo_version

features = []
if raw_features is not None:
Expand Down Expand Up @@ -70,7 +74,7 @@
else:
options += f" --features \"{','.join(features)}\""

command = f"cargo {cmd} --example {example_name} --release"
command = f"cargo +{cargo_version} {cmd} --example {example_name} --release"
if options is not None:
command += f" {options}"
if "{{NPROCESSES}}" in command:
Expand Down
28 changes: 28 additions & 0 deletions generation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[features]
strict = []
slice-static-tables = []

[lib]
proc-macro = true

[package]
name = "bempp-generation"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bempp-tools = { path = "../tools" }
bempp-traits = { path = "../traits" }
bempp-element = { path = "../element" }
bempp-bem = { path = "../bem" }
bempp-grid = { path = "../grid" }
bempp-quadrature = { path = "../quadrature" }
quote = { version = "1.0" }
syn = { version = "2.0.22" }
num = "0.4"
approx = "0.5"

[build-dependencies]
rustversion = "1.0"
7 changes: 7 additions & 0 deletions generation/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[rustversion::not(nightly)]
fn main() {}

#[rustversion::nightly]
fn main() {
println!("cargo:rustc-cfg=nightly");
}
102 changes: 102 additions & 0 deletions generation/examples/kernels.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#![cfg_attr(nightly, feature(core_intrinsics))]

use bempp_generation::generate_kernels;
use bempp_traits::element::FiniteElement;

fn main() {
generate_kernels!(
dp0_dp0_kernel,
"Lagrange",
"Triangle",
0,
true,
"Lagrange",
"Triangle",
0,
true,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false
);
generate_kernels!(
p1_p1_kernel,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false
);
generate_kernels!(
p1_p2_kernel,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
2,
false,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false
);
generate_kernels!(
high_order_geometry_kernel,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
2,
false,
"Lagrange",
"Triangle",
2,
false
);
generate_kernels!(
mixed_order_geometry_kernel,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
1,
false,
"Lagrange",
"Triangle",
2,
false,
"Lagrange",
"Triangle",
1,
false
);
}
Loading
Loading