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

smoke tests on all platforms #33

Merged
merged 5 commits into from
Nov 13, 2024
Merged
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
6 changes: 5 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile
source /Users/runner/.bash_profile
ln -s $(which gfortran-14) /usr/local/bin/gfortran

gcc --version
gfortran --version
Expand Down Expand Up @@ -218,7 +219,7 @@ jobs:
mkdir build
cd build

PATH="/c/Program\ Files/LLVM/bin:$PATH"
export PATH="/c/Program\ Files/LLVM/bin:$PATH"

cmake \
-G Ninja \
Expand Down Expand Up @@ -248,6 +249,9 @@ jobs:
echo "working dir is $PWD"

cd build

export PATH="/d/a/_temp/msys64/clang64/bin:$PATH"
pacman -Sy --noconfirm diffutils

ctest -VV

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
/all_solvers/*

.DS_Store

NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat
NFsim_v1.11/tests/smoke/SimID_273069657_0_.species

IDAWin/tests/smoke/SimID_1489333437_0_.ida
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ if (${OPTION_TARGET_DOCS})
endif()

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
elseif (MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Choose minimum deploy target for Macos machines")
endif()

Expand Down
60 changes: 9 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
FROM ubuntu:20.04 as build
FROM python:3.9.7-slim AS build

RUN apt-get -y update && apt-get install -y apt-utils && \
apt-get install -y -qq -o=Dpkg::Use-Pty=0 build-essential gfortran zlib1g-dev \
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python

#
# build PETSc with mpich for static linking
#
RUN mkdir /usr/local/petsc && \
cd /usr/local/petsc && \
wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.7.7.tar.gz && \
tar xzf petsc-3.7.7.tar.gz && \
cd petsc-3.7.7 && \
./configure --with-shared-libraries=0 --download-fblaslapack=1 --with-debugging=1 --download-mpich && \
make PETSC_DIR=/usr/local/petsc/petsc-3.7.7 PETSC_ARCH=arch-linux2-c-debug all

ENV PETSC_DIR=/usr/local/petsc/petsc-3.7.7 \
PETSC_ARCH=arch-linux2-c-debug
libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip

COPY . /vcellroot

#
# build most solvers, and FiniteVolume without PETSc (FiniteVolume_x64)
#
RUN mkdir -p /vcellroot/build/bin
WORKDIR /vcellroot/build

Expand All @@ -41,33 +24,9 @@ RUN /usr/bin/cmake \
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
.. && \
make && \
ctest

#
# build FiniteVolume with PETSc (FiniteVolume_PETSc_x64)
#
RUN mkdir -p /vcellroot/build_PETSc/bin
WORKDIR /vcellroot/build_PETSc

RUN /usr/bin/cmake \
-DOPTION_TARGET_MESSAGING=ON \
-DOPTION_TARGET_PARALLEL=OFF \
-DOPTION_TARGET_PETSC=ON \
-DOPTION_TARGET_CHOMBO2D_SOLVER=OFF \
-DOPTION_TARGET_CHOMBO3D_SOLVER=OFF \
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_STOCHASTIC_SOLVER=OFF \
-DOPTION_TARGET_NFSIM_SOLVER=OFF \
-DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
-DOPTION_TARGET_SUNDIALS_SOLVER=OFF \
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
.. && \
make && \
ctest

ctest -VV

FROM eclipse-temurin:17 as jre-build
FROM eclipse-temurin:17 AS jre-build

# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
Expand All @@ -81,22 +40,21 @@ RUN $JAVA_HOME/bin/jlink \
# Define base image and copy in jlink created minimal Java 17 environment
FROM python:3.9.7-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17 and Python 3.9
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8

RUN apt-get update && \
RUN apt-get -y update && \
apt-get install -y apt-utils && \
apt-get install -q -y --no-install-recommends curl dnsutils

RUN apt-get install -qq -y -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 gcc gfortran zlib1g \
libhdf5-103 libhdf5-cpp-103 libcurl4-openssl-dev zip

COPY --from=build /vcellroot/build/bin /vcellbin
COPY --from=build /vcellroot/build_PETSc/bin/FiniteVolume_PETSc_x64 /vcellbin/

WORKDIR /vcellbin
ENV PATH=/vcellbin:$PATH

13 changes: 13 additions & 0 deletions IDAWin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ install(TARGETS IDAWin ARCHIVE DESTINATION bin)

enable_testing()

if (MINGW)
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE}.exe)
set(python_cmd py)
else (MINGW)
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE})
set(python_cmd python3)
endif (MINGW)
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/tests/smoke)

# smoke test as a python script, for bash test example, see NFsim/tests/smoke
add_test(NAME ${EXE_FILE}_smoke COMMAND ${python_cmd} ${test_dir}/smoke.py ${test_sundials_exe} WORKING_DIRECTORY ${test_dir})


add_executable(
hello_test
hello_test.cpp
Expand Down
6 changes: 6 additions & 0 deletions IDAWin/SundialsSolverStandalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ int main(int argc, char *argv[]) {
break;
}
}
#ifdef USE_MESSAGING
// should only happen during testing for solver compiled with messaging but run locally.
if (SimulationMessaging::getInstVar() == nullptr) {
SimulationMessaging::create();
}
#endif

if (solver.empty()) {
throw "Solver not defined ";
Expand Down
14 changes: 14 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SOLVER CVODE
STARTING_TIME 0.0
ENDING_TIME 1.0
RELATIVE_TOLERANCE 1.0E-9
ABSOLUTE_TOLERANCE 1.0E-9
MAX_TIME_STEP 1.0
OUTPUT_TIMES 8
0.0 1.0E-5 1.0E-4 0.001 0.01 0.1 0.5 1.0
NUM_EQUATIONS 2
ODE s2 INIT 4.0;
RATE - ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2))));
ODE s4 INIT 0.0;
RATE 0.0;

10 changes: 10 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##---------------------------------------------
## /Users/jimschaff/.vcell/simdata/temp/SimID_1489333437_0_.functions
##---------------------------------------------

Compartment::J_r0; ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2)))); ; Nonspatial_VariableType; false
Compartment::J_r1; 0.0; ; Nonspatial_VariableType; false
Compartment::s0; (2.0 * (-1.0 + (0.5 * s2))); ; Nonspatial_VariableType; false
Compartment::s1; (2.0 * (3.5 - (0.5 * s2))); ; Nonspatial_VariableType; false
Compartment::s3; - s4; ; Nonspatial_VariableType; false

9 changes: 9 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
t:s2:s4:
0.00000000000000000E+00 4.00000000000000000E+00 0.00000000000000000E+00
1.00000000000000008E-05 3.99998000095349759E+00 0.00000000000000000E+00
1.00000000000000005E-04 3.99980008070643711E+00 0.00000000000000000E+00
1.00000000000000002E-03 3.99800797408532871E+00 0.00000000000000000E+00
1.00000000000000002E-02 3.98077784306128457E+00 0.00000000000000000E+00
1.00000000000000006E-01 3.86170998966032331E+00 0.00000000000000000E+00
5.00000000000000000E-01 3.74758417187014503E+00 0.00000000000000000E+00
1.00000000000000000E+00 3.74179783773998942E+00 0.00000000000000000E+00
3 changes: 3 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IDAData logfile
IDAData text format version 1
SimID_1489333437_0_.ida
76 changes: 76 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<SimulationTask xmlns="http://sourceforge.net/projects/vcell/vcml" TaskId="0" JobIndex="0" isPowerUser="false">
<MathDescription Name="Application0_generated">
<Constant Name="_F_">96485.3321</Constant>
<Constant Name="_F_nmol_">9.64853321E-5</Constant>
<Constant Name="_K_GHK_">1.0E-9</Constant>
<Constant Name="_N_pmol_">6.02214179E11</Constant>
<Constant Name="_PI_">3.141592653589793</Constant>
<Constant Name="_R_">8314.46261815</Constant>
<Constant Name="_T_">300.0</Constant>
<Constant Name="K_millivolts_per_volt">1000.0</Constant>
<Constant Name="Kf_r0">1.0</Constant>
<Constant Name="Kf_r1">0.0</Constant>
<Constant Name="KMOLE">0.001660538783162726</Constant>
<Constant Name="Kr_r0">2.0</Constant>
<Constant Name="Kr_r1">0.0</Constant>
<Constant Name="s0_init_uM">2.0</Constant>
<Constant Name="s1_init_uM">3.0</Constant>
<Constant Name="s2_init_uM">4.0</Constant>
<Constant Name="s3_init_uM">0.0</Constant>
<Constant Name="s4_init_uM">0.0</Constant>
<Constant Name="Size_c0">0.5</Constant>
<VolumeVariable Name="s2" Domain="Compartment" />
<VolumeVariable Name="s4" Domain="Compartment" />
<Function Name="J_r0" Domain="Compartment">(((Kf_r0 * s0) * s2) - (Kr_r0 * s1))</Function>
<Function Name="J_r1" Domain="Compartment">((Kf_r1 * s3) - (Kr_r1 * s4))</Function>
<Function Name="K_s0_total" Domain="Compartment">((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM))</Function>
<Function Name="K_s1_total" Domain="Compartment">((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM))</Function>
<Function Name="K_s3_total" Domain="Compartment">((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM))</Function>
<Function Name="s0" Domain="Compartment">((K_s0_total + (Size_c0 * s2)) / Size_c0)</Function>
<Function Name="s1" Domain="Compartment">((K_s1_total - (Size_c0 * s2)) / Size_c0)</Function>
<Function Name="s3" Domain="Compartment">((K_s3_total - (Size_c0 * s4)) / Size_c0)</Function>
<CompartmentSubDomain Name="Compartment">
<BoundaryType Boundary="Xm" Type="Value" />
<BoundaryType Boundary="Xp" Type="Value" />
<BoundaryType Boundary="Ym" Type="Value" />
<BoundaryType Boundary="Yp" Type="Value" />
<BoundaryType Boundary="Zm" Type="Value" />
<BoundaryType Boundary="Zp" Type="Value" />
<OdeEquation Name="s2" SolutionType="Unknown">
<Rate>- J_r0</Rate>
<Initial>s2_init_uM</Initial>
</OdeEquation>
<OdeEquation Name="s4" SolutionType="Unknown">
<Rate>J_r1</Rate>
<Initial>s4_init_uM</Initial>
</OdeEquation>
</CompartmentSubDomain>
<Version Name="Application0_generated" KeyValue="95705054" BranchId="95705055" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
</Version>
</MathDescription>
<Simulation Name="Simulation0">
<SolverTaskDescription TaskType="Unsteady" UseSymbolicJacobian="false" Solver="Combined Stiff Solver (IDA/CVODE)">
<TimeBound StartTime="0.0" EndTime="1.0" />
<TimeStep DefaultTime="0.1" MinTime="1.0E-8" MaxTime="1.0" />
<ErrorTolerance Absolut="1.0E-9" Relative="1.0E-9" />
<OutputOptions OutputTimes="0.0,1.0E-5,1.0E-4,0.001,0.01,0.1,0.5,1.0" />
<NumberProcessors>1</NumberProcessors>
</SolverTaskDescription>
<MathOverrides />
<Version Name="temp simulation" KeyValue="1489333437" BranchId="1" Archived="1" Date="28-Jul-2024 18:28:21" FromVersionable="false">
<Owner Name="temp" Identifier="123" />
<GroupAccess Type="1" />
</Version>
</Simulation>
<Geometry Name="non-spatial420951543" Dimension="0">
<Extent X="10.0" Y="10.0" Z="10.0" />
<Origin X="0.0" Y="0.0" Z="0.0" />
<SubVolume Name="Compartment" Handle="0" Type="Compartmental" KeyValue="95705043" />
<Version Name="non-spatial420951543" KeyValue="95705039" BranchId="95705040" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
</Version>
</Geometry>
</SimulationTask>
Loading