-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add actions workflow with unit tests for smarSimFunctionObject
- Loading branch information
1 parent
260ad12
commit 0ce4ac2
Showing
11 changed files
with
157 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: smartsim | ||
defaults: | ||
run: | ||
shell: bash -o pipefail -i {0} | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'smartsim*' | ||
- 'static_client' | ||
- 'releases/**' | ||
pull_request: | ||
types: [opened, reopened] | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
type: boolean | ||
description: 'Tmate debugging session' | ||
required: false | ||
default: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
container: | ||
image: ghcr.io/foamscience/openfoam-smartsim:cpu | ||
options: --user openfoam | ||
env: | ||
CATCH_TIMEOUT: 20 | ||
FOAM_FOAMUT: "/tmp/foamUT" | ||
SSBD: "redis:6379" | ||
|
||
services: | ||
redis: | ||
image: redislabs/redisai | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@v3 | ||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | ||
with: | ||
detached: true | ||
|
||
- name: Compile and Test | ||
run: | | ||
cd 2023-01/smartsim | ||
source /usr/lib/openfoam/openfoam2212/etc/bashrc | ||
mkdir -p $FOAM_USER_LIBBIN | ||
./Allwmake | ||
git clone https://github.com/FoamScience/foamUT $FOAM_FOAMUT | ||
sed -i 's/mpirun/mpirun --oversubscribe/g' $FOAM_FOAMUT/Alltest | ||
ln -s "$PWD"/smartsim_function_object/smartSimFunctionObject "$FOAM_FOAMUT"/smartSimFunctionObject | ||
ln -s "$PWD"/smartsim_function_object/tests "$FOAM_FOAMUT"/tests/smartSimFOTests | ||
cd $FOAM_FOAMUT || exit 1 | ||
rm -rf tests/exampleTests | ||
./Alltest "$@" | ||
if [ -f $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake ]; then cat $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/bash | ||
|
||
wmake smartsim_function_object/smartSimFunctionObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Dockerfile to build SmartSim/SmartRedis-ready images for developing OpenFOAM-related stuff | ||
#FROM opencfd/openfoam-dev | ||
# The images from OpenCFD do not play nice with Github, so I use my own ones | ||
FROM ghcr.io/foamscience/jammy-openfoam:v2212 | ||
LABEL maintainer="Mohammed Elwardi Fadeli <[email protected]>" | ||
|
||
# Dependencies | ||
USER root | ||
RUN apt update && apt install -y python3-dev python3-pip git-core git-lfs cmake unzip vim wget | ||
RUN apt clean && apt autoremove --yes && rm -rf /var/lib/{cache,log}/ | ||
|
||
# Software versions; overriding these has no effect on resulting containers; but nice to have | ||
# as environment variables to remove version confusion | ||
ENV SMARTREDIS_VERSION="6bfcf1deb0d726df75610fe8a352b9ecb13c44f7" | ||
ENV SMARTSIM_VERSION="0.5.1" | ||
|
||
# Install SmartSim (maybe get the development version for this too?) | ||
RUN pip install smartsim[ml]==$SMARTSIM_VERSION | ||
|
||
USER openfoam | ||
|
||
# Build SmartRedis | ||
ENV FOAM_SMARTREDIS=$HOME/smartredis | ||
RUN git clone https://github.com/CrayLabs/SmartRedis $FOAM_SMARTREDIS &&\ | ||
cd $FOAM_SMARTREDIS && git reset --hard $SMARTREDIS_VERSION | ||
RUN cd $FOAM_SMARTREDIS && sudo smart clobber && sudo smart build --device=cpu && make lib | ||
|
||
# Environment variables to use for linking SmartRedis libs to OpenFOAM bins/libs | ||
ENV SMARTREDIS_INCLUDE=$FOAM_SMARTREDIS/install/include | ||
ENV SMARTREDIS_LIB=$FOAM_SMARTREDIS/install/lib | ||
ENV LD_LIBRARY_PATH=$SMARTREDIS_LIB:$LD_LIBRARY_PATH | ||
RUN find /usr/lib/openfoam -iname DiagonalMatrix.H -exec sudo sed -i 's/DiagonalMatrix<Type>/DiagonalMatrix/g' {} \; | ||
WORKDIR $HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$(FOAM_FOAMUT)/tests/testDriver.C | ||
|
||
smartSimFOTest.C | ||
|
||
EXE = ./testDriver |
17 changes: 17 additions & 0 deletions
17
2023-01/smartsim/smartsim_function_object/tests/Make/options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
EXE_INC = -std=c++2a \ | ||
-Wno-old-style-cast \ | ||
-I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
-I$(LIB_SRC)/meshTools/lnInclude \ | ||
-I$(SMARTREDIS_INCLUDE) \ | ||
-I$(FOAM_FOAMUT)/smartSimFunctionObject/lnInclude \ | ||
-I$(FOAM_USER_LIBBIN)/catch2/include \ | ||
-I$(LIB_SRC)/Pstream/lnInclude | ||
|
||
EXE_LIBS = \ | ||
-lfiniteVolume \ | ||
-lmeshTools \ | ||
-L$(FOAM_USER_LIBBIN) -L$(FOAM_LIBBIN)/$(FOAM_MPI) \ | ||
-L$(FOAM_USER_LIBBIN)/catch2/lib -l:libCatch2.a \ | ||
-lPstream \ | ||
-L$(SMARTREDIS_LIB) -lhiredis -lredis++ \ | ||
-lsmartredis -lsmartSimFunctionObject |
26 changes: 26 additions & 0 deletions
26
2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "IOobject.H" | ||
#include "PstreamReduceOps.H" | ||
#include "catch2/catch_all.hpp" | ||
#include "catch2/catch_test_macros.hpp" | ||
#include "fvCFD.H" | ||
#include "fvMesh.H" | ||
|
||
#include <csetjmp> | ||
#include <csignal> | ||
#include <cstdlib> | ||
#include <functional> | ||
|
||
using namespace Foam; | ||
extern Time* timePtr; | ||
extern argList* argsPtr; | ||
|
||
TEST_CASE("Shared SmartRedis client", "[cavity][serial][parallel]") | ||
{ | ||
dictionary dict; | ||
dict.set("type", "smartSimFunctionObject"); | ||
dict.set("fieldNames", wordList()); | ||
dict.set("fieldDimensions", labelList()); | ||
functionObjects::smartSimFunctionObject fo1("smartSimFo1", *timePtr, dict); | ||
functionObjects::smartSimFunctionObject fo2("smartSimFo2", *timePtr, dict); | ||
REQUIRE(&fo1.redisDB == &fo2.redisDB); | ||
} |
15 changes: 0 additions & 15 deletions
15
2023-01/smartsim/smartsim_mesh_motion/configure-smartredis.sh
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters