File tree Expand file tree Collapse file tree 11 files changed +157
-34
lines changed
smartredis-simpleFoam/simpleRedisFoam/Make
smartSimFunctionObject/Make
displacementSmartSimMotionSolver/Make Expand file tree Collapse file tree 11 files changed +157
-34
lines changed Original file line number Diff line number Diff line change 1+ name : smartsim
2+ defaults :
3+ run :
4+ shell : bash -o pipefail -i {0}
5+ on :
6+ push :
7+ branches :
8+ - main
9+ - ' smartsim*'
10+ - ' static_client'
11+ - ' releases/**'
12+ pull_request :
13+ types : [opened, reopened]
14+ workflow_dispatch :
15+ inputs :
16+ debug_enabled :
17+ type : boolean
18+ description : ' Tmate debugging session'
19+ required : false
20+ default : false
21+
22+ jobs :
23+ build :
24+ runs-on : ubuntu-22.04
25+
26+ container :
27+ image : ghcr.io/foamscience/openfoam-smartsim:cpu
28+ options : --user openfoam
29+ env :
30+ CATCH_TIMEOUT : 20
31+ FOAM_FOAMUT : " /tmp/foamUT"
32+ SSBD : " redis:6379"
33+
34+ services :
35+ redis :
36+ image : redislabs/redisai
37+
38+ steps :
39+ - name : Checkout repository
40+ uses : actions/checkout@v3
41+
42+ - name : Setup tmate session
43+ uses : mxschmitt/action-tmate@v3
44+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
45+ with :
46+ detached : true
47+
48+ - name : Compile and Test
49+ run : |
50+ cd 2023-01/smartsim
51+ source /usr/lib/openfoam/openfoam2212/etc/bashrc
52+ mkdir -p $FOAM_USER_LIBBIN
53+ ./Allwmake
54+ git clone https://github.com/FoamScience/foamUT $FOAM_FOAMUT
55+ sed -i 's/mpirun/mpirun --oversubscribe/g' $FOAM_FOAMUT/Alltest
56+ ln -s "$PWD"/smartsim_function_object/smartSimFunctionObject "$FOAM_FOAMUT"/smartSimFunctionObject
57+ ln -s "$PWD"/smartsim_function_object/tests "$FOAM_FOAMUT"/tests/smartSimFOTests
58+ cd $FOAM_FOAMUT || exit 1
59+ rm -rf tests/exampleTests
60+ ./Alltest "$@"
61+ if [ -f $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake ]; then cat $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake; fi
Original file line number Diff line number Diff line change 1+ #! /usr/bin/bash
2+
3+ wmake smartsim_function_object/smartSimFunctionObject
Original file line number Diff line number Diff line change 1+ # Dockerfile to build SmartSim/SmartRedis-ready images for developing OpenFOAM-related stuff
2+ # FROM opencfd/openfoam-dev
3+ # The images from OpenCFD do not play nice with Github, so I use my own ones
4+ FROM ghcr.io/foamscience/jammy-openfoam:v2212
5+ LABEL maintainer="Mohammed Elwardi Fadeli <elwardi.fadeli@tu-darmstadt.de>"
6+
7+ # Dependencies
8+ USER root
9+ RUN apt update && apt install -y python3-dev python3-pip git-core git-lfs cmake unzip vim wget
10+ RUN apt clean && apt autoremove --yes && rm -rf /var/lib/{cache,log}/
11+
12+ # Software versions; overriding these has no effect on resulting containers; but nice to have
13+ # as environment variables to remove version confusion
14+ ENV SMARTREDIS_VERSION="6bfcf1deb0d726df75610fe8a352b9ecb13c44f7"
15+ ENV SMARTSIM_VERSION="0.5.1"
16+
17+ # Install SmartSim (maybe get the development version for this too?)
18+ RUN pip install smartsim[ml]==$SMARTSIM_VERSION
19+
20+ USER openfoam
21+
22+ # Build SmartRedis
23+ ENV FOAM_SMARTREDIS=$HOME/smartredis
24+ RUN git clone https://github.com/CrayLabs/SmartRedis $FOAM_SMARTREDIS &&\
25+ cd $FOAM_SMARTREDIS && git reset --hard $SMARTREDIS_VERSION
26+ RUN cd $FOAM_SMARTREDIS && sudo smart clobber && sudo smart build --device=cpu && make lib
27+
28+ # Environment variables to use for linking SmartRedis libs to OpenFOAM bins/libs
29+ ENV SMARTREDIS_INCLUDE=$FOAM_SMARTREDIS/install/include
30+ ENV SMARTREDIS_LIB=$FOAM_SMARTREDIS/install/lib
31+ ENV LD_LIBRARY_PATH=$SMARTREDIS_LIB:$LD_LIBRARY_PATH
32+ RUN find /usr/lib/openfoam -iname DiagonalMatrix.H -exec sudo sed -i 's/DiagonalMatrix<Type>/DiagonalMatrix/g' {} \;
33+ WORKDIR $HOME
Original file line number Diff line number Diff line change 33# Define environmental variables for including and linking SmartRedis in
44# OpenFOAM applications and libraries.
55
6- echo Warning: make sure you sourced configure-smartredis.sh in its folder.
7- # Otherwise, the include files for OpenFOAM application/library compilations will be wrong.
8-
96export FOAM_SMARTREDIS=$PWD /smartredis
10- export FOAM_SMARTREDIS_INCLUDE= $FOAM_SMARTREDIS /include
11- export FOAM_SMARTREDIS_DEP_INCLUDE= $FOAM_SMARTREDIS /install/include
12- export FOAM_SMARTREDIS_LIB= $FOAM_SMARTREDIS /install/lib
13- export FOAM_SMARTREDIS_BUILD_LIB =$FOAM_SMARTREDIS /build
14- export LD_LIBRARY_PATH= $FOAM_SMARTREDIS_BUILD_LIB : $LD_LIBRARY_PATH
7+ if [ ! -d " $FOAM_SMARTREDIS " ] ; then
8+ echo " $FOAM_SMARTREDIS does not exist, please source configure-smartredis.sh from its folder "
9+ fi
10+ export SMARTREDIS_INCLUDE =$FOAM_SMARTREDIS /install/include
11+ export SMARTREDIS_LIB= $FOAM_SMARTREDIS /install/lib
1512export LD_LIBRARY_PATH=$FOAM_SMARTREDIS_LIB :$LD_LIBRARY_PATH
1613export SSDB=" 127.0.0.1:8000" # for multinode setup let smartsim do this
Original file line number Diff line number Diff line change @@ -7,8 +7,7 @@ EXE_INC = \
77 -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
88 -I$(LIB_SRC)/transportModels \
99 -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
10- -I$(FOAM_SMARTREDIS_INCLUDE) \
11- -I$(FOAM_SMARTREDIS_DEP_INCLUDE)
10+ -I$(SMARTREDIS_INCLUDE)
1211
1312EXE_LIBS = \
1413 -lfiniteVolume \
@@ -19,5 +18,5 @@ EXE_LIBS = \
1918 -lincompressibleTurbulenceModels \
2019 -lincompressibleTransportModels \
2120 -latmosphericModels \
22- -L$(FOAM_SMARTREDIS_LIB ) -lhiredis -lredis++ \
23- -L$(FOAM_SMARTREDIS_BUILD_LIB) - lsmartredis
21+ -L$(SMARTREDIS_LIB ) -lhiredis -lredis++ \
22+ -lsmartredis
Original file line number Diff line number Diff line change @@ -3,12 +3,10 @@ EXE_INC = \
33 -Wno-old-style-cast \
44 -I$(LIB_SRC)/finiteVolume/lnInclude \
55 -I$(LIB_SRC)/meshTools/lnInclude \
6- -I$(FOAM_SMARTREDIS_INCLUDE) \
7- -I$(FOAM_SMARTREDIS_DEP_INCLUDE)
6+ -I$(SMARTREDIS_INCLUDE)
87
98LIB_LIBS = \
10- -L$(FOAM_SMARTREDIS_LIB) \
119 -lfiniteVolume \
1210 -lmeshTools \
13- -L$(FOAM_SMARTREDIS_LIB ) -lhiredis -lredis++ \
11+ -L$(SMARTREDIS_LIB ) -lhiredis -lredis++ \
1412 -lsmartredis
Original file line number Diff line number Diff line change 1+ $(FOAM_FOAMUT)/tests/testDriver.C
2+
3+ smartSimFOTest.C
4+
5+ EXE = ./testDriver
Original file line number Diff line number Diff line change 1+ EXE_INC = -std=c++2a \
2+ -Wno-old-style-cast \
3+ -I$(LIB_SRC)/finiteVolume/lnInclude \
4+ -I$(LIB_SRC)/meshTools/lnInclude \
5+ -I$(SMARTREDIS_INCLUDE) \
6+ -I$(FOAM_FOAMUT)/smartSimFunctionObject/lnInclude \
7+ -I$(FOAM_USER_LIBBIN)/catch2/include \
8+ -I$(LIB_SRC)/Pstream/lnInclude
9+
10+ EXE_LIBS = \
11+ -lfiniteVolume \
12+ -lmeshTools \
13+ -L$(FOAM_USER_LIBBIN) -L$(FOAM_LIBBIN)/$(FOAM_MPI) \
14+ -L$(FOAM_USER_LIBBIN)/catch2/lib -l:libCatch2.a \
15+ -lPstream \
16+ -L$(SMARTREDIS_LIB) -lhiredis -lredis++ \
17+ -lsmartredis -lsmartSimFunctionObject
Original file line number Diff line number Diff line change 1+ #include "IOobject.H"
2+ #include "PstreamReduceOps.H"
3+ #include "catch2/catch_all.hpp"
4+ #include "catch2/catch_test_macros.hpp"
5+ #include "fvCFD.H"
6+ #include "fvMesh.H"
7+
8+ #include <csetjmp>
9+ #include <csignal>
10+ #include <cstdlib>
11+ #include <functional>
12+
13+ using namespace Foam ;
14+ extern Time * timePtr ;
15+ extern argList * argsPtr ;
16+
17+ TEST_CASE ("Shared SmartRedis client" , "[cavity][serial][parallel]" )
18+ {
19+ dictionary dict ;
20+ dict .set ("type" , "smartSimFunctionObject" );
21+ dict .set ("fieldNames" , wordList ());
22+ dict .set ("fieldDimensions" , labelList ());
23+ functionObjects ::smartSimFunctionObject fo1 ("smartSimFo1" , * timePtr , dict );
24+ functionObjects ::smartSimFunctionObject fo2 ("smartSimFo2" , * timePtr , dict );
25+ REQUIRE (& fo1 .redisDB == & fo2 .redisDB );
26+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments