Skip to content

Commit

Permalink
Add Ninja ability (#46)
Browse files Browse the repository at this point in the history
* Add Ninja ability

* Can't have two when

* Yaml fix?

* Adjust indent

* Adjust indent part 2

* Remove cmake_generator from runtests

* Fix greet per shellcheck

* Add TERM to create

* Update to v10.23.0 bcs
  • Loading branch information
mathomp4 authored Sep 15, 2022
1 parent 0643977 commit f655252
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 24 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

## [1.12.0] - 2022-09-14

### Added

- Add ability to use Ninja generator during CMake

### Changed

- Update executors to default to v10.23.0

## [1.11.0] - 2022-08-30

### Added
Expand Down
32 changes: 27 additions & 5 deletions src/commands/buildinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,32 @@ parameters:
description: "Number of processes for rebuild step"
type: integer
default: 4
cmake_generator:
description: CMake Generator
type: enum
default: "Unix Makefiles"
enum: ["Unix Makefiles", "Ninja"]

steps:
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" install |& tee /logfiles/make.log || make -j << parameters.rebuild_procs >> install |& tee /logfiles/make-retry.log
- when:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build and install - GNU Make"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" install |& tee /logfiles/make.log || make -j << parameters.rebuild_procs >> install |& tee /logfiles/make-retry.log
- unless:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build and install - Ninja"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
ninja -j "$(nproc)" install |& tee /logfiles/ninja.log || ninja -j << parameters.rebuild_procs >> install |& tee /logfiles/ninja-retry.log
33 changes: 28 additions & 5 deletions src/commands/buildtarget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,33 @@ parameters:
description: "Number of processes for rebuild step"
type: integer
default: 4
cmake_generator:
description: CMake Generator
type: enum
default: "Unix Makefiles"
enum: ["Unix Makefiles", "Ninja"]

steps:
- run:
name: "Build target << parameters.target >> (retry after fail)"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" << parameters.target >> |& tee /logfiles/make.log || make -j << parameters.rebuild_procs >> << parameters.target >> |& tee /logfiles/make-retry.log
- when:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build target << parameters.target >> (retry after fail) - GNU Make"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" << parameters.target >> |& tee /logfiles/make.log || make -j << parameters.rebuild_procs >> << parameters.target >> |& tee /logfiles/make-retry.log
- unless:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build target << parameters.target >> (retry after fail) - Ninja"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
ninja -j "$(nproc)" << parameters.target >> |& tee /logfiles/ninja.log || ninja -j << parameters.rebuild_procs >> << parameters.target >> |& tee /logfiles/ninja-retry.log
33 changes: 28 additions & 5 deletions src/commands/buildtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,33 @@ parameters:
description: "Number of processes for rebuild step"
type: integer
default: 4
cmake_generator:
description: CMake Generator
type: enum
default: "Unix Makefiles"
enum: ["Unix Makefiles", "Ninja"]

steps:
- run:
name: "Build tests"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" build-tests |& tee /logfiles/build-tests.log || make -j << parameters.rebuild_procs >> build-tests |& tee /logfiles/build-tests-retry.log
- when:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build tests - GNU Make"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
make -j "$(nproc)" build-tests |& tee /logfiles/build-tests.log || make -j << parameters.rebuild_procs >> build-tests |& tee /logfiles/build-tests-retry.log
- unless:
condition:
matches:
pattern: "^Unix Makefiles$"
value: << parameters.cmake_generator >>
steps:
- run:
name: "Build tests - Ninja"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
ninja -j "$(nproc)" build-tests |& tee /logfiles/build-tests.log || ninja -j << parameters.rebuild_procs >> build-tests |& tee /logfiles/build-tests-retry.log
13 changes: 9 additions & 4 deletions src/commands/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ parameters:
type: enum
default: ""
enum: ["", "R4", "R8", "R4R8"]
cmake_generator:
description: CMake Generator
type: enum
default: "Unix Makefiles"
enum: ["Unix Makefiles", "Ninja"]

steps:
- run:
Expand All @@ -36,16 +41,16 @@ steps:
condition: << parameters.fv_precision >>
steps:
- run:
name: "Run CMake with FV_PRECISION=<< parameters.fv_precision>>"
name: "Run CMake with FV_PRECISION=<< parameters.fv_precision>> using << parameters.cmake_generator >>"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=<< parameters.build_type >> -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> << parameters.extra_cmake_options >> -DFV_PRECISION=<< parameters.fv_precision >> |& tee /logfiles/cmake.log
cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -G "<< parameters.cmake_generator >>" -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=<< parameters.build_type >> -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> << parameters.extra_cmake_options >> -DFV_PRECISION=<< parameters.fv_precision >> |& tee /logfiles/cmake.log
- unless:
condition: << parameters.fv_precision >>
steps:
- run:
name: "Run CMake"
name: "Run CMake using << parameters.cmake_generator >>"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-<< parameters.repo >>
cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=<< parameters.build_type >> -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> << parameters.extra_cmake_options >> |& tee /logfiles/cmake.log
cmake ${CIRCLE_WORKING_DIRECTORY}/<< parameters.repo >> -G "<< parameters.cmake_generator >>" -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=<< parameters.build_type >> -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-<< parameters.repo >> << parameters.extra_cmake_options >> |& tee /logfiles/cmake.log
2 changes: 2 additions & 0 deletions src/commands/create_gcm_expt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ parameters:
steps:
- run:
name: "Run create_expt.py"
environment:
TERM: dumb
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/<< parameters.workspace_root >>/install-<< parameters.repo >>/bin
/TinyBCs-GitV10/scripts/create_expt.py << parameters.gcm_experiment_name >> --expdir ${CIRCLE_WORKING_DIRECTORY}/<< parameters.workspace_root >> --horz << parameters.gcm_horz_resolution >> --vert << parameters.gcm_vert_resolution >>
Expand Down
2 changes: 1 addition & 1 deletion src/executors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ They have on two optional parameters:

1. `resource_class` which defaults to `large`
2. `baselibs_version` which defaults to `v7.5.0`
3. `bcs_version` which defaults to `v10.22.5`
3. `bcs_version` which defaults to `v10.23.0`

## See:
- [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration)
Expand Down
2 changes: 1 addition & 1 deletion src/executors/gfortran-bcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters:
type: string
bcs_version:
description: "Version of boundary conditions to use"
default: v10.22.5
default: v10.23.0
type: string

docker:
Expand Down
2 changes: 1 addition & 1 deletion src/executors/ifort-bcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters:
type: string
bcs_version:
description: "Version of boundary conditions to use"
default: v10.22.5
default: v10.23.0
type: string

docker:
Expand Down
8 changes: 8 additions & 0 deletions src/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ parameters:
description: Extra options to pass to CMake
type: string
default: ""
cmake_generator:
description: CMake Generator
type: enum
default: "Unix Makefiles"
enum: ["Unix Makefiles", "Ninja"]
fv_precision:
description: Precision to build FV3
type: enum
Expand Down Expand Up @@ -140,16 +145,19 @@ steps:
build_type: << parameters.build_type >>
extra_cmake_options: << parameters.extra_cmake_options >>
fv_precision: << parameters.fv_precision >>
cmake_generator: << parameters.cmake_generator >>
- buildtarget:
repo: << parameters.repo >>
rebuild_procs: << parameters.rebuild_procs >>
target: << parameters.buildtarget >>
cmake_generator: << parameters.cmake_generator >>
- when:
condition: << parameters.run_unit_tests >>
steps:
- buildtests:
repo: << parameters.repo >>
rebuild_procs: << parameters.rebuild_procs >>
cmake_generator: << parameters.cmake_generator >>
- runtests:
repo: << parameters.repo >>
ctest_options: << parameters.ctest_options >>
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/run_gcm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ parameters:
description: "Baselibs version to use"
bcs_version:
type: string
default: v10.22.5
default: v10.23.0
description: "Boundary condition version to use"
workspace_root:
description: "Workspace root"
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/greet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Greet() {
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-core"
if [ "${0#*$ORB_TEST_ENV}" == "$0" ]; then
if [ "${0#*"$ORB_TEST_ENV"}" == "$0" ]; then
Greet
fi

0 comments on commit f655252

Please sign in to comment.