From b9988dfbea8ffc35012d766966d87885a1c5bf9c Mon Sep 17 00:00:00 2001 From: jcschaff Date: Sun, 28 Jul 2024 11:42:24 -0400 Subject: [PATCH 1/5] smoke test for NFsim runs with bash and python3 on all platforms --- .github/workflows/cd.yml | 6 +- .gitignore | 3 + CMakeLists.txt | 8 +- Dockerfile | 78 +++++++++---------- NFsim_v1.11/CMakeLists.txt | 19 ++++- .../smoke/SimID_273069657_0_.gdat.expected | 12 +++ .../tests/smoke/SimID_273069657_0_.nfsimInput | 1 + .../smoke/SimID_273069657_0_.species.expected | 5 ++ NFsim_v1.11/tests/smoke/smoke.py | 69 ++++++++++++++++ NFsim_v1.11/tests/smoke/smoke.sh | 62 +++++++++++++++ .../include/VCELL/SimulationMessaging.h | 4 +- VCellMessaging/src/SimulationMessaging.cpp | 5 +- 12 files changed, 227 insertions(+), 45 deletions(-) create mode 100644 NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat.expected create mode 100644 NFsim_v1.11/tests/smoke/SimID_273069657_0_.nfsimInput create mode 100644 NFsim_v1.11/tests/smoke/SimID_273069657_0_.species.expected create mode 100755 NFsim_v1.11/tests/smoke/smoke.py create mode 100755 NFsim_v1.11/tests/smoke/smoke.sh diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 478669a89..ec460a97b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 @@ -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 \ @@ -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 diff --git a/.gitignore b/.gitignore index 2c0fede2f..f006e5125 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ /all_solvers/* .DS_Store + +NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat +NFsim_v1.11/tests/smoke/SimID_273069657_0_.species diff --git a/CMakeLists.txt b/CMakeLists.txt index 22c78cfb6..d2291161c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/Dockerfile b/Dockerfile index a3dee25b0..4e495e5c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,22 @@ -FROM ubuntu:20.04 as build +FROM ubuntu:22.04 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 + +## +## 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 COPY . /vcellroot @@ -41,30 +41,30 @@ RUN /usr/bin/cmake \ -DOPTION_TARGET_HY3S_SOLVERS=OFF \ .. && \ make && \ - ctest + ctest -VV +## +## build FiniteVolume with PETSc (FiniteVolume_PETSc_x64) +## +#RUN mkdir -p /vcellroot/build_PETSc/bin +#WORKDIR /vcellroot/build_PETSc # -# 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 +#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 FROM eclipse-temurin:17 as jre-build @@ -96,7 +96,7 @@ RUN apt-get install -qq -y -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/ +#COPY --from=build /vcellroot/build_PETSc/bin/FiniteVolume_PETSc_x64 /vcellbin/ WORKDIR /vcellbin ENV PATH=/vcellbin:$PATH diff --git a/NFsim_v1.11/CMakeLists.txt b/NFsim_v1.11/CMakeLists.txt index 1b449ef44..68771ed82 100755 --- a/NFsim_v1.11/CMakeLists.txt +++ b/NFsim_v1.11/CMakeLists.txt @@ -87,10 +87,27 @@ endif (UNIX) set(exe_target NFsim) if (ARCH_64bit) set(exe_target ${exe_target}_x64) -endif (ARCH_64bit) +endif (ARCH_64bit) + +enable_testing() add_executable(${exe_target} ${SRC_FILES}) target_link_libraries(${exe_target} vcommons vcellmessaging) +if (MINGW) + set(test_nfsim_exe ${CMAKE_BINARY_DIR}/bin/${exe_target}.exe) + set(python_cmd py) +else (MINGW) + set(test_nfsim_exe ${CMAKE_BINARY_DIR}/bin/${exe_target}) + set(python_cmd python3) +endif (MINGW) +set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/tests/smoke) + +# smoke test as a python script +add_test(NAME ${exe_target}_smoke_python COMMAND ${python_cmd} ${test_dir}/smoke.py ${test_nfsim_exe} WORKING_DIRECTORY ${test_dir}) + +# smoke test as a bash script +add_test(NAME ${exe_target}_smoke_bash COMMAND bash -c "${test_dir}/smoke.sh ${test_nfsim_exe}" WORKING_DIRECTORY ${test_dir}) + install(TARGETS ${exe_target} RUNTIME DESTINATION ${OPTION_EXE_DIRECTORY}) diff --git a/NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat.expected b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat.expected new file mode 100644 index 000000000..1d3c606d5 --- /dev/null +++ b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat.expected @@ -0,0 +1,12 @@ +# time O0_MT0_tot_Count O0_MT1_tot_Count O0_MT2_tot_Count O0_MT3_tot_Count O0_MT4_tot_Count s0_Count s1_Count s2_Count s3_Count s4_Count + 0.00000000e+00 6.02000000e+02 9.03000000e+02 1.20400000e+03 0.00000000e+00 0.00000000e+00 6.02000000e+02 9.03000000e+02 1.20400000e+03 0.00000000e+00 0.00000000e+00 + 1.00000000e-01 5.37000000e+02 9.68000000e+02 1.13900000e+03 0.00000000e+00 0.00000000e+00 5.37000000e+02 9.68000000e+02 1.13900000e+03 0.00000000e+00 0.00000000e+00 + 2.00000000e-01 5.24000000e+02 9.81000000e+02 1.12600000e+03 0.00000000e+00 0.00000000e+00 5.24000000e+02 9.81000000e+02 1.12600000e+03 0.00000000e+00 0.00000000e+00 + 3.00000000e-01 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 + 4.00000000e-01 5.30000000e+02 9.75000000e+02 1.13200000e+03 0.00000000e+00 0.00000000e+00 5.30000000e+02 9.75000000e+02 1.13200000e+03 0.00000000e+00 0.00000000e+00 + 5.00000000e-01 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 5.23000000e+02 9.82000000e+02 1.12500000e+03 0.00000000e+00 0.00000000e+00 + 6.00000000e-01 5.21000000e+02 9.84000000e+02 1.12300000e+03 0.00000000e+00 0.00000000e+00 5.21000000e+02 9.84000000e+02 1.12300000e+03 0.00000000e+00 0.00000000e+00 + 7.00000000e-01 5.20000000e+02 9.85000000e+02 1.12200000e+03 0.00000000e+00 0.00000000e+00 5.20000000e+02 9.85000000e+02 1.12200000e+03 0.00000000e+00 0.00000000e+00 + 8.00000000e-01 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 + 9.00000000e-01 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 5.13000000e+02 9.92000000e+02 1.11500000e+03 0.00000000e+00 0.00000000e+00 + 1.00000000e+00 5.33000000e+02 9.72000000e+02 1.13500000e+03 0.00000000e+00 0.00000000e+00 5.33000000e+02 9.72000000e+02 1.13500000e+03 0.00000000e+00 0.00000000e+00 diff --git a/NFsim_v1.11/tests/smoke/SimID_273069657_0_.nfsimInput b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.nfsimInput new file mode 100644 index 000000000..310f94fda --- /dev/null +++ b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.nfsimInput @@ -0,0 +1 @@ +((O0_MT0_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0)((O0_MT1_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0)((O0_MT2_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0)((O0_MT3_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0)((O0_MT4_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0)((UnitFactor_uM_um3_molecules_neg_1 * s0_Count) / Size_c0)((UnitFactor_uM_um3_molecules_neg_1 * s1_Count) / Size_c0)((UnitFactor_uM_um3_molecules_neg_1 * s2_Count) / Size_c0)((UnitFactor_uM_um3_molecules_neg_1 * s3_Count) / Size_c0)((UnitFactor_uM_um3_molecules_neg_1 * s4_Count) / Size_c0)k8s-wn-01.cam.uchc.edu:30163clientUserdummyworkerEventserviceControlschaff2730696570 \ No newline at end of file diff --git a/NFsim_v1.11/tests/smoke/SimID_273069657_0_.species.expected b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.species.expected new file mode 100644 index 000000000..c80fe267d --- /dev/null +++ b/NFsim_v1.11/tests/smoke/SimID_273069657_0_.species.expected @@ -0,0 +1,5 @@ +# nfsim generated species list for system: 'nameless' +# warning! this feature is not yet fully tested! +MT0(AAA~c0,AAB~0) 532 +MT1(AAA~c0,AAB~0) 973 +MT2(AAA~c0,AAB~0) 1134 diff --git a/NFsim_v1.11/tests/smoke/smoke.py b/NFsim_v1.11/tests/smoke/smoke.py new file mode 100755 index 000000000..ac9570926 --- /dev/null +++ b/NFsim_v1.11/tests/smoke/smoke.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + +import os +import posixpath +import subprocess +import sys + +# get the directory of this script +test_dir = os.path.dirname(os.path.realpath(__file__)) +# in the path replace \ with /, D:\ with /d/ +test_dir = test_dir.replace("\\", "/") +# tell os.path.join to use / as the path separator +os.path.sep = "/" +exe = sys.argv[1] + +print(f"test_dir: {test_dir}") +print(f"exe: {exe}") + +input_file = posixpath.join(test_dir, "SimID_273069657_0_.nfsimInput") +output = posixpath.join(test_dir, "SimID_273069657_0_.gdat") +expected_output = posixpath.join(test_dir, "SimID_273069657_0_.gdat.expected") +species = posixpath.join(test_dir, "SimID_273069657_0_.species") +expected_species = posixpath.join(test_dir, "SimID_273069657_0_.species.expected") + +if not posixpath.exists(exe): + print(f"NFsim executable {exe} not found. Exiting...") + sys.exit(1) + +if not posixpath.exists(input_file): + print(f"Input file {input_file} not found. Exiting...") + sys.exit(1) + +if not posixpath.exists(expected_output): + print(f"Expected output file {expected_output} not found. Exiting...") + sys.exit(1) + +if not posixpath.exists(expected_species): + print(f"Expected species file {expected_species} not found. Exiting...") + sys.exit(1) + +command = [exe, "-seed", "505790288", "-vcell", "-xml", input_file, "-o", output, "-sim", "1.0", "-ss", species, "-oStep", "20", "-notf", "-utl", "1000", "-cb", "-pcmatch", "-tid", "0"] +print(" ".join(command)) + +try: + subprocess.check_call(command) +except subprocess.CalledProcessError: + print("NFsim failed to run. Exiting...") + sys.exit(1) + +# verify that the output files exist +if not os.path.isfile(output): + print(f"Output file {output} not found. Exiting...") + sys.exit(1) + +if not os.path.isfile(species): + print(f"Species file {species} not found. Exiting...") + sys.exit(1) + +# verify that the output files match the expected output files +if open(output).read() != open(expected_output).read(): + print(f"Output file {output} does not match expected output {expected_output}. Exiting...") + sys.exit(1) + +if open(species).read() != open(expected_species).read(): + print(f"Species file {species} does not match expected species {expected_species}. Exiting...") + sys.exit(1) + +print("NFsim solver completed and solution matched expected output. Exiting...") +sys.exit(0) \ No newline at end of file diff --git a/NFsim_v1.11/tests/smoke/smoke.sh b/NFsim_v1.11/tests/smoke/smoke.sh new file mode 100755 index 000000000..d58eb0506 --- /dev/null +++ b/NFsim_v1.11/tests/smoke/smoke.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e +EXE=$1 + +echo "Running NFsim solver with test2.sh $EXE" + +# get the directory of this script +TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +INPUT="${TEST_DIR}/SimID_273069657_0_.nfsimInput" +OUTPUT="${TEST_DIR}/SimID_273069657_0_.gdat" +EXPECTED_OUTPUT="${TEST_DIR}/SimID_273069657_0_.gdat.expected" +SPECIES="${TEST_DIR}/SimID_273069657_0_.species" +EXPECTED_SPECIES="${TEST_DIR}/SimID_273069657_0_.species.expected" + +if [ ! -f $EXE ]; then + echo "NFsim executable $EXE not found. Exiting..." + exit 1 +fi +if [ ! -f $INPUT ]; then + echo "Input file $INPUT not found. Exiting..." + exit 1 +fi +if [ ! -f $EXPECTED_OUTPUT ]; then + echo "Expected output file $EXPECTED_OUTPUT not found. Exiting..." + exit 1 +fi +if [ ! -f $EXPECTED_SPECIES ]; then + echo "Expected species file $EXPECTED_SPECIES not found. Exiting..." + exit 1 +fi + + +command="$EXE -seed 505790288 -vcell -xml $INPUT -o $OUTPUT -sim 1.0 -ss $SPECIES -oStep 20 -notf -utl 1000 -cb -pcmatch -tid 0" +echo $command +if ! $command; then + echo "NFsim failed to run. Exiting..." + exit 1 +fi + +# verify that the output files exist +if [ ! -f $OUTPUT ]; then + echo "Output file $OUTPUT not found. Exiting..." + exit 1 +fi +if [ ! -f $SPECIES ]; then + echo "Species file $SPECIES not found. Exiting..." + exit 1 +fi + +# verify that the output files match the expected output files +if ! diff $OUTPUT $EXPECTED_OUTPUT; then + echo "Output file $OUTPUT does not match expected output $EXPECTED_OUTPUT. Exiting..." + exit 1 +fi +if ! diff $SPECIES $EXPECTED_SPECIES; then + echo "Species file $SPECIES does not match expected species $EXPECTED_SPECIES. Exiting..." + exit 1 +fi + +echo "NFsim solver complted and solution matched expected output. Exiting..." +exit 0 diff --git a/VCellMessaging/include/VCELL/SimulationMessaging.h b/VCellMessaging/include/VCELL/SimulationMessaging.h index 20979cced..3180e2118 100644 --- a/VCellMessaging/include/VCELL/SimulationMessaging.h +++ b/VCellMessaging/include/VCELL/SimulationMessaging.h @@ -1,7 +1,7 @@ #ifndef _SIMULATIONMESSAGING_H_ #define _SIMULATIONMESSAGING_H_ -#include +#include #ifdef USE_MESSAGING #include #include @@ -145,7 +145,7 @@ class SimulationMessaging private: SimulationMessaging(); static SimulationMessaging *m_inst; - std::deque events; + std::vector events; int workerEventOutputMode; void sendStatus(); diff --git a/VCellMessaging/src/SimulationMessaging.cpp b/VCellMessaging/src/SimulationMessaging.cpp index 4747cb85d..5537ff495 100644 --- a/VCellMessaging/src/SimulationMessaging.cpp +++ b/VCellMessaging/src/SimulationMessaging.cpp @@ -155,7 +155,10 @@ void SimulationMessaging::sendStatus() { WorkerEventLocker locker(*this); if (events.size( ) > 0 ) { workerEvent = events.front( ); - events.pop_front( ); + if (!events.empty()) + { + events.erase(events.begin()); + } } else { return; From 42fec0fe46b6f2f9c780757391e717982c10fb65 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Sun, 28 Jul 2024 23:14:20 -0400 Subject: [PATCH 2/5] add smoke test for CVODE solver --- .gitignore | 2 + IDAWin/CMakeLists.txt | 13 + IDAWin/SundialsSolverStandalone.cpp | 6 + .../smoke/SimID_1489333437_0_.cvodeInput | 14 + .../tests/smoke/SimID_1489333437_0_.functions | 10 + .../smoke/SimID_1489333437_0_.ida.expected | 9 + IDAWin/tests/smoke/SimID_1489333437_0_.log | 3 + .../smoke/SimID_1489333437_0__0.simtask.xml | 76 +++ .../tests/smoke/simpleModel_Network_orig.vcml | 621 ++++++++++++++++++ IDAWin/tests/smoke/smoke.py | 72 ++ NFsim_v1.11/CMakeLists.txt | 7 +- .../tests/smoke/simpleModel_Network_orig.vcml | 621 ++++++++++++++++++ NFsim_v1.11/tests/smoke/smoke.sh | 21 +- 13 files changed, 1462 insertions(+), 13 deletions(-) create mode 100644 IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput create mode 100644 IDAWin/tests/smoke/SimID_1489333437_0_.functions create mode 100644 IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected create mode 100644 IDAWin/tests/smoke/SimID_1489333437_0_.log create mode 100644 IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml create mode 100644 IDAWin/tests/smoke/simpleModel_Network_orig.vcml create mode 100755 IDAWin/tests/smoke/smoke.py create mode 100644 NFsim_v1.11/tests/smoke/simpleModel_Network_orig.vcml diff --git a/.gitignore b/.gitignore index f006e5125..c0b8d3fa7 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ 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 diff --git a/IDAWin/CMakeLists.txt b/IDAWin/CMakeLists.txt index 0be56202a..0dcf9f0a3 100644 --- a/IDAWin/CMakeLists.txt +++ b/IDAWin/CMakeLists.txt @@ -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 diff --git a/IDAWin/SundialsSolverStandalone.cpp b/IDAWin/SundialsSolverStandalone.cpp index bf88dadd0..bbdcf3e6c 100644 --- a/IDAWin/SundialsSolverStandalone.cpp +++ b/IDAWin/SundialsSolverStandalone.cpp @@ -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 "; diff --git a/IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput b/IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput new file mode 100644 index 000000000..7afffdd13 --- /dev/null +++ b/IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput @@ -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; + diff --git a/IDAWin/tests/smoke/SimID_1489333437_0_.functions b/IDAWin/tests/smoke/SimID_1489333437_0_.functions new file mode 100644 index 000000000..bb7262127 --- /dev/null +++ b/IDAWin/tests/smoke/SimID_1489333437_0_.functions @@ -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 + diff --git a/IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected b/IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected new file mode 100644 index 000000000..eb40f12de --- /dev/null +++ b/IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected @@ -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 diff --git a/IDAWin/tests/smoke/SimID_1489333437_0_.log b/IDAWin/tests/smoke/SimID_1489333437_0_.log new file mode 100644 index 000000000..ad570edba --- /dev/null +++ b/IDAWin/tests/smoke/SimID_1489333437_0_.log @@ -0,0 +1,3 @@ +IDAData logfile +IDAData text format version 1 +SimID_1489333437_0_.ida diff --git a/IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml b/IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml new file mode 100644 index 000000000..d173c8bce --- /dev/null +++ b/IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml @@ -0,0 +1,76 @@ + + + 96485.3321 + 9.64853321E-5 + 1.0E-9 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1000.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + + + (((Kf_r0 * s0) * s2) - (Kr_r0 * s1)) + ((Kf_r1 * s3) - (Kr_r1 * s4)) + ((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM)) + ((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM)) + ((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM)) + ((K_s0_total + (Size_c0 * s2)) / Size_c0) + ((K_s1_total - (Size_c0 * s2)) / Size_c0) + ((K_s3_total - (Size_c0 * s4)) / Size_c0) + + + + + + + + + - J_r0 + s2_init_uM + + + J_r1 + s4_init_uM + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IDAWin/tests/smoke/simpleModel_Network_orig.vcml b/IDAWin/tests/smoke/simpleModel_Network_orig.vcml new file mode 100644 index 000000000..75d2470a5 --- /dev/null +++ b/IDAWin/tests/smoke/simpleModel_Network_orig.vcml @@ -0,0 +1,621 @@ + + + + + + + + + + + + + + + + + + + + + + (((Kf * s0) * s2) - (Kr * s1)) + 1.0 + 2.0 + + + + + + + ((Kf * s3) - (Kr * s4)) + 0.0 + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + 96485.3321 + 9.64853321E-5 + 1.0E-9 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1000.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + + + (((Kf_r0 * s0) * s2) - (Kr_r0 * s1)) + ((Kf_r1 * s3) - (Kr_r1 * s4)) + ((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM)) + ((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM)) + ((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM)) + ((K_s0_total + (Size_c0 * s2)) / Size_c0) + ((K_s1_total - (Size_c0 * s2)) / Size_c0) + ((K_s3_total - (Size_c0 * s4)) / Size_c0) + + + + + + + + + - J_r0 + s2_init_uM + + + J_r1 + s4_init_uM + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + 96485.3321 + 9.64853321E-5 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + (1.0 * pow(KMOLE, - 1.0)) + (1.0 * pow(KMOLE,1.0)) + + + + + + (((Kf_r0 * s0) * s2) - (Kr_r0 * s1)) + ((Kf_r1 * s3) - (Kr_r1 * s4)) + (Kf_r0 * s0_Count * s2_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1 * UnitFactor_uM_um3_molecules_neg_1 / Size_c0) + (Kr_r0 * s1_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + (Kf_r1 * s3_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + (Kr_r1 * s4_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + ((UnitFactor_uM_um3_molecules_neg_1 * s0_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s0_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s1_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s1_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s2_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s2_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s3_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s3_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s4_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s4_Count_init_uM) + + + + + + + + s0_Count_initCount + s1_Count_initCount + s2_Count_initCount + s3_Count_initCount + s4_Count_initCount + + P_r0_probabilityRate + -1.0 + -1.0 + 1.0 + + + P_r0_reverse_probabilityRate + 1.0 + 1.0 + -1.0 + + + P_r1_probabilityRate + -1.0 + 1.0 + + + P_r1_reverse_probabilityRate + 1.0 + -1.0 + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + + + + + + 96485.3321 + 9.64853321E-5 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + (1.0 * pow(KMOLE, - 1.0)) + (1.0 * pow(KMOLE,1.0)) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ((O0_MT0_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT1_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT2_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT3_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT4_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((UnitFactor_uM_um3_molecules_neg_1 * Kf_r00) / Size_c0) + Kr_r00 + Kf_r10 + Kr_r10 + ((UnitFactor_uM_um3_molecules_neg_1 * s0_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s0_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s1_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s1_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s2_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s2_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s3_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s3_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s4_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s4_Count_init_uM) + + + + + + + + + + + P_r00_probabilityRate + + + + + + + P_r00_reverse_probabilityRate + + + + + + + P_r10_probabilityRate + + + + + + P_r10_reverse_probabilityRate + + + + + + s0_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s1_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s2_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s3_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s4_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + + + + + + + + + + true + false + true + true + 1000 + 1 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDAWin/tests/smoke/smoke.py b/IDAWin/tests/smoke/smoke.py new file mode 100755 index 000000000..65f4d7fee --- /dev/null +++ b/IDAWin/tests/smoke/smoke.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +import os +import posixpath +import subprocess +import sys +from pathlib import Path + + +# function to numerically compare the contents of two text files to determine approximate equality +# each line is a space delimited list of numbers, compare them to within 8 significant figures +def compare_files(file1: Path, file2: Path, tolerance: float): + with open(file1, 'r') as f1, open(file2, 'r') as f2: + for line1, line2 in zip(f1, f2): + if (line1 := line1.strip()) == (line2 := line2.strip()): + continue + array1 = [float(x) for x in line1.split()] + array2 = [float(x) for x in line2.split()] + for x, y in zip(array1, array2): + if x != y and abs(x - y) > tolerance * max(abs(x), abs(y)): + return False + return True + + +# get the directory of this script +test_dir = os.path.dirname(os.path.realpath(__file__)) +# in the path replace \ with /, D:\ with /d/ +test_dir = test_dir.replace("\\", "/") +# tell os.path.join to use / as the path separator +os.path.sep = "/" +exe = sys.argv[1] + +print(f"test_dir: {test_dir}") +print(f"exe: {exe}") + +input_file = posixpath.join(test_dir, "SimID_1489333437_0_.cvodeInput") +output_file = posixpath.join(test_dir, "SimID_1489333437_0_.ida") +expected_output_file = posixpath.join(test_dir, "SimID_1489333437_0_.ida.expected") + +if not posixpath.exists(exe): + print(f"SundialsSolverStandalone_x64 executable {exe} not found. Exiting...") + sys.exit(1) + +if not posixpath.exists(input_file): + print(f"Input file {input_file} not found. Exiting...") + sys.exit(1) + +if not posixpath.exists(expected_output_file): + print(f"Expected output file {expected_output_file} not found. Exiting...") + sys.exit(1) + +command = [exe, input_file, output_file] +print(" ".join(command)) + +try: + subprocess.check_call(command) +except subprocess.CalledProcessError: + print("SundialsSolverStandalone_x64 failed to run. Exiting...") + sys.exit(1) + +# verify that the output files exist +if not os.path.isfile(output_file): + print(f"Output file {output_file} not found. Exiting...") + sys.exit(1) + +# verify that the output files match the expected output files +if not compare_files(file1=Path(output_file), file2=Path(expected_output_file), tolerance=1e-8): + print(f"Output file {output_file} does not match expected output {expected_output_file}. Exiting...") + sys.exit(1) + +print("SundialsSolverStandalone_x64 solver completed and solution matched expected output. Exiting...") +sys.exit(0) diff --git a/NFsim_v1.11/CMakeLists.txt b/NFsim_v1.11/CMakeLists.txt index 68771ed82..254e653b1 100755 --- a/NFsim_v1.11/CMakeLists.txt +++ b/NFsim_v1.11/CMakeLists.txt @@ -89,10 +89,12 @@ if (ARCH_64bit) set(exe_target ${exe_target}_x64) endif (ARCH_64bit) -enable_testing() - add_executable(${exe_target} ${SRC_FILES}) target_link_libraries(${exe_target} vcommons vcellmessaging) +install(TARGETS ${exe_target} RUNTIME DESTINATION ${OPTION_EXE_DIRECTORY}) + + +enable_testing() if (MINGW) set(test_nfsim_exe ${CMAKE_BINARY_DIR}/bin/${exe_target}.exe) @@ -109,5 +111,4 @@ add_test(NAME ${exe_target}_smoke_python COMMAND ${python_cmd} ${test_dir}/smoke # smoke test as a bash script add_test(NAME ${exe_target}_smoke_bash COMMAND bash -c "${test_dir}/smoke.sh ${test_nfsim_exe}" WORKING_DIRECTORY ${test_dir}) -install(TARGETS ${exe_target} RUNTIME DESTINATION ${OPTION_EXE_DIRECTORY}) diff --git a/NFsim_v1.11/tests/smoke/simpleModel_Network_orig.vcml b/NFsim_v1.11/tests/smoke/simpleModel_Network_orig.vcml new file mode 100644 index 000000000..7b16957d3 --- /dev/null +++ b/NFsim_v1.11/tests/smoke/simpleModel_Network_orig.vcml @@ -0,0 +1,621 @@ + + + + + + + + + + + + + + + + + + + + + + (((Kf * s0) * s2) - (Kr * s1)) + 1.0 + 2.0 + + + + + + + ((Kf * s3) - (Kr * s4)) + 0.0 + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + 96485.3321 + 9.64853321E-5 + 1.0E-9 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1000.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + + + (((Kf_r0 * s0) * s2) - (Kr_r0 * s1)) + ((Kf_r1 * s3) - (Kr_r1 * s4)) + ((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM)) + ((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM)) + ((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM)) + ((K_s0_total + (Size_c0 * s2)) / Size_c0) + ((K_s1_total - (Size_c0 * s2)) / Size_c0) + ((K_s3_total - (Size_c0 * s4)) / Size_c0) + + + + + + + + + - J_r0 + s2_init_uM + + + J_r1 + s4_init_uM + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + 96485.3321 + 9.64853321E-5 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + (1.0 * pow(KMOLE, - 1.0)) + (1.0 * pow(KMOLE,1.0)) + + + + + + (((Kf_r0 * s0) * s2) - (Kr_r0 * s1)) + ((Kf_r1 * s3) - (Kr_r1 * s4)) + (Kf_r0 * s0_Count * s2_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1 * UnitFactor_uM_um3_molecules_neg_1 / Size_c0) + (Kr_r0 * s1_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + (Kf_r1 * s3_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + (Kr_r1 * s4_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1) + ((UnitFactor_uM_um3_molecules_neg_1 * s0_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s0_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s1_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s1_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s2_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s2_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s3_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s3_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s4_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s4_Count_init_uM) + + + + + + + + s0_Count_initCount + s1_Count_initCount + s2_Count_initCount + s3_Count_initCount + s4_Count_initCount + + P_r0_probabilityRate + -1.0 + -1.0 + 1.0 + + + P_r0_reverse_probabilityRate + 1.0 + 1.0 + -1.0 + + + P_r1_probabilityRate + -1.0 + 1.0 + + + P_r1_reverse_probabilityRate + 1.0 + -1.0 + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + 0.0 + + + 3.0 + 0.0 + + + 4.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + + + + + + 96485.3321 + 9.64853321E-5 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1.0 + 0.0 + 0.001660538783162726 + 2.0 + 0.0 + 2.0 + 3.0 + 4.0 + 0.0 + 0.0 + 0.5 + (1.0 * pow(KMOLE, - 1.0)) + (1.0 * pow(KMOLE,1.0)) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ((O0_MT0_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT1_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT2_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT3_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((O0_MT4_tot_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_c0) + ((UnitFactor_uM_um3_molecules_neg_1 * Kf_r00) / Size_c0) + Kr_r00 + Kf_r10 + Kr_r10 + ((UnitFactor_uM_um3_molecules_neg_1 * s0_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s0_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s1_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s1_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s2_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s2_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s3_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s3_Count_init_uM) + ((UnitFactor_uM_um3_molecules_neg_1 * s4_Count) / Size_c0) + (UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_c0 * s4_Count_init_uM) + + + + + + + + + + + P_r00_probabilityRate + + + + + + + P_r00_reverse_probabilityRate + + + + + + + P_r10_probabilityRate + + + + + + P_r10_reverse_probabilityRate + + + + + + s0_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s1_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s2_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s3_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + s4_Count_initCount + 0.0 + u + u + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + + + + + + + + + + true + false + true + true + 1000 + 1 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NFsim_v1.11/tests/smoke/smoke.sh b/NFsim_v1.11/tests/smoke/smoke.sh index d58eb0506..69ade0cba 100755 --- a/NFsim_v1.11/tests/smoke/smoke.sh +++ b/NFsim_v1.11/tests/smoke/smoke.sh @@ -2,7 +2,7 @@ set -e EXE=$1 -echo "Running NFsim solver with test2.sh $EXE" +echo "Running NFsim solver with smoke.sh $EXE" # get the directory of this script TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -13,50 +13,51 @@ EXPECTED_OUTPUT="${TEST_DIR}/SimID_273069657_0_.gdat.expected" SPECIES="${TEST_DIR}/SimID_273069657_0_.species" EXPECTED_SPECIES="${TEST_DIR}/SimID_273069657_0_.species.expected" -if [ ! -f $EXE ]; then +if [ ! -f "$EXE" ]; then echo "NFsim executable $EXE not found. Exiting..." exit 1 fi -if [ ! -f $INPUT ]; then +if [ ! -f "$INPUT" ]; then echo "Input file $INPUT not found. Exiting..." exit 1 fi -if [ ! -f $EXPECTED_OUTPUT ]; then +if [ ! -f "$EXPECTED_OUTPUT" ]; then echo "Expected output file $EXPECTED_OUTPUT not found. Exiting..." exit 1 fi -if [ ! -f $EXPECTED_SPECIES ]; then +if [ ! -f "$EXPECTED_SPECIES" ]; then echo "Expected species file $EXPECTED_SPECIES not found. Exiting..." exit 1 fi command="$EXE -seed 505790288 -vcell -xml $INPUT -o $OUTPUT -sim 1.0 -ss $SPECIES -oStep 20 -notf -utl 1000 -cb -pcmatch -tid 0" -echo $command +echo "$command" if ! $command; then echo "NFsim failed to run. Exiting..." exit 1 fi # verify that the output files exist -if [ ! -f $OUTPUT ]; then +if [ ! -f "$OUTPUT" ]; then echo "Output file $OUTPUT not found. Exiting..." exit 1 fi +# shellcheck disable=SC2086 if [ ! -f $SPECIES ]; then echo "Species file $SPECIES not found. Exiting..." exit 1 fi # verify that the output files match the expected output files -if ! diff $OUTPUT $EXPECTED_OUTPUT; then +if ! diff "$OUTPUT" "$EXPECTED_OUTPUT"; then echo "Output file $OUTPUT does not match expected output $EXPECTED_OUTPUT. Exiting..." exit 1 fi -if ! diff $SPECIES $EXPECTED_SPECIES; then +if ! diff "$SPECIES" "$EXPECTED_SPECIES"; then echo "Species file $SPECIES does not match expected species $EXPECTED_SPECIES. Exiting..." exit 1 fi -echo "NFsim solver complted and solution matched expected output. Exiting..." +echo "NFsim solver completed and solution matched expected output. Exiting..." exit 0 From 8aacbd815bb2990ffe79f9768f2e6cce9a4c2135 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Mon, 29 Jul 2024 20:09:37 -0400 Subject: [PATCH 3/5] Simplified single-stage Dockerfile --- Dockerfile | 91 +++++++++++------------------------------------------- 1 file changed, 18 insertions(+), 73 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e495e5c2..8f36089c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,27 @@ -FROM ubuntu:22.04 as build +FROM eclipse-temurin:17-jdk-jammy 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 python3 + libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 && \ + apt-get install -q -y --no-install-recommends curl dnsutils -## -## 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 +# Create a custom Java runtime +RUN $JAVA_HOME/bin/jlink \ + --add-modules ALL-MODULE-PATH \ + --strip-debug \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime + +ENV JAVA_HOME=/javaruntime +ENV PATH="${JAVA_HOME}/bin:${PATH}" -#ENV PETSC_DIR=/usr/local/petsc/petsc-3.7.7 \ -# PETSC_ARCH=arch-linux2-c-debug +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=en_US.UTF-8 COPY . /vcellroot -# -# build most solvers, and FiniteVolume without PETSc (FiniteVolume_x64) -# RUN mkdir -p /vcellroot/build/bin WORKDIR /vcellroot/build @@ -41,62 +40,8 @@ RUN /usr/bin/cmake \ -DOPTION_TARGET_HY3S_SOLVERS=OFF \ .. && \ make && \ - ctest -VV - -## -## 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 - - -FROM eclipse-temurin:17 as jre-build - -# Create a custom Java runtime -RUN $JAVA_HOME/bin/jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime + ctest -VV && \ + mv /vcellroot/build/bin /vcellbin -# 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}" -COPY --from=jre-build /javaruntime $JAVA_HOME - -# now we have Java 17 and Python 3.9 -ENV DEBIAN_FRONTEND noninteractive -ENV LANG=en_US.UTF-8 - -RUN apt-get 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 \ - 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 - From 96941976f32284bb1a68b940bc4796f5e4575399 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Mon, 29 Jul 2024 23:48:16 -0400 Subject: [PATCH 4/5] 2 stage Docker build to reduce size for singularity --- Dockerfile | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f36089c2..221910834 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,10 @@ -FROM eclipse-temurin:17-jdk-jammy +FROM eclipse-temurin:17-jdk-jammy 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 python3 && \ + libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip && \ apt-get install -q -y --no-install-recommends curl dnsutils -# Create a custom Java runtime -RUN $JAVA_HOME/bin/jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime - -ENV JAVA_HOME=/javaruntime -ENV PATH="${JAVA_HOME}/bin:${PATH}" - -ENV DEBIAN_FRONTEND=noninteractive -ENV LANG=en_US.UTF-8 - COPY . /vcellroot RUN mkdir -p /vcellroot/build/bin @@ -40,8 +25,31 @@ RUN /usr/bin/cmake \ -DOPTION_TARGET_HY3S_SOLVERS=OFF \ .. && \ make && \ - ctest -VV && \ - mv /vcellroot/build/bin /vcellbin + ctest -VV + +FROM eclipse-temurin:17-jdk-jammy as runtime + +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 python3 python3-pip && \ + apt-get install -q -y --no-install-recommends curl dnsutils + +# Create a custom Java runtime +RUN $JAVA_HOME/bin/jlink \ + --add-modules ALL-MODULE-PATH \ + --strip-debug \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime + +ENV JAVA_HOME=/javaruntime +ENV PATH="${JAVA_HOME}/bin:${PATH}" + +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=en_US.UTF-8 + +COPY --from=build /vcellroot/build/bin /vcellbin WORKDIR /vcellbin ENV PATH=/vcellbin:$PATH From 68eb1f2b70564b4e435dd3257e332253494ffeb2 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Mon, 12 Aug 2024 08:09:53 -0400 Subject: [PATCH 5/5] smaller multistage builds --- Dockerfile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 221910834..243f19eaf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ -FROM eclipse-temurin:17-jdk-jammy 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 python3 python3-pip && \ - apt-get install -q -y --no-install-recommends curl dnsutils + libhdf5-dev libcurl4-openssl-dev libboost-dev cmake wget python3 python3-pip COPY . /vcellroot @@ -27,12 +26,7 @@ RUN /usr/bin/cmake \ make && \ ctest -VV -FROM eclipse-temurin:17-jdk-jammy as runtime - -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 python3 python3-pip && \ - apt-get install -q -y --no-install-recommends curl dnsutils +FROM eclipse-temurin:17 AS jre-build # Create a custom Java runtime RUN $JAVA_HOME/bin/jlink \ @@ -43,12 +37,23 @@ RUN $JAVA_HOME/bin/jlink \ --compress=2 \ --output /javaruntime -ENV JAVA_HOME=/javaruntime +# 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}" +COPY --from=jre-build /javaruntime $JAVA_HOME +# now we have Java 17 and Python 3.9 ENV DEBIAN_FRONTEND=noninteractive ENV LANG=en_US.UTF-8 +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 -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 WORKDIR /vcellbin