Skip to content

Commit 88cc391

Browse files
Fixed bad parsing when looking for messaging params
1 parent b8a6b3f commit 88cc391

15 files changed

+688
-96
lines changed

.github/workflows/cd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
if: matrix.platform == 'macos-15-intel'
5555
shell: bash
5656
run: |
57-
brew install llvm
5857
python3 -m pip install conan
5958
conan --version
6059
mkdir -p ~/.conan2/profiles/

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat
2424
NFsim_v1.11/tests/smoke/SimID_273069657_0_.species
2525

26-
IDAWin/tests/smoke/SimID_1489333437_0_.ida
26+
*.ida
2727

2828
CMakeUserPresets.json
2929
conan-build

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
FROM debian:bookworm-slim AS build
1+
FROM debian:trixie-slim AS build
22
SHELL ["/bin/bash", "-c"]
33

44
RUN apt-get -y update && apt-get install -y apt-utils && apt-get remove --purge gcc
5-
RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 clang mold ninja-build cmake libc++-16-dev libc++abi-16-dev libcurl4-openssl-dev \
6-
git curl wget ca-certificates python3 python3-pip
5+
RUN apt-get install -y -qq -o=Dpkg::Use-Pty=0 mold ninja-build cmake clang-18 clang++-18 clang-tools-18 libc++-18-dev libc++abi-18-dev \
6+
libcurl4-openssl-dev git curl wget ca-certificates python3 python3-pip
77
RUN rm $(which gcc) || true
88
RUN rm $(which g++) || true
99
RUN rm -rf /var/lib/apt/lists/* && rm /usr/bin/ld
10+
#RUN ln -s $(which clang-18) /usr/bin/clang
11+
#RUN ln -s $(which clang++-18) /usr/bin/clang++
1012
RUN ln -s $(which mold) /usr/bin/ld
1113

1214
COPY . /vcellroot
1315

1416
RUN mkdir -p /vcellroot/build/bin
1517
WORKDIR /vcellroot/build
1618

19+
RUN clang++ --version
1720
RUN /usr/bin/cmake .. -G Ninja -DOPTION_TARGET_MESSAGING=ON -DOPTION_TARGET_DOCS=OFF
1821
RUN ninja --verbose
1922
RUN ctest -VV

IDAWin/SundialsSolverInterface.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
//
44
// Messaging
55
#include "SundialsSolverInterface.h"
6-
#ifdef USE_MESSAGING
7-
#include <VCELL/SimulationMessaging.h>
8-
#include <memory.h>
9-
#endif
10-
// Standard Includes
11-
// -> None
12-
// Local Includes
136
#include "VCellSundialsSolver.h"
147
#include "VCellSolverFactory.h"
158

@@ -60,6 +53,13 @@ void activateSolver(std::ifstream& inputFileStream, FILE* outputFile, int taskID
6053
// vss->solve(nullptr, true, outputFile, VCellSundialsSolver::checkStopRequested);
6154
// delete vss;
6255

56+
// Check if we have messaging and a taskID of -1; if so; fail now.
57+
58+
#ifdef USE_MESSAGING
59+
if (taskID < 0) {
60+
throw std::runtime_error("task id of value: " + std::to_string(taskID) + " not acceptable when this library is built with messaging");
61+
}
62+
#endif
6363

6464
VCellSolver* targetSolver = VCellSolverFactory::produceVCellSolver(inputFileStream, taskID);
6565
targetSolver->solve(nullptr, true, outputFile, VCellSundialsSolver::checkStopRequested);

IDAWin/VCellSolverFactory.cpp

Lines changed: 22 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "VCellCVodeSolver.h"
1515
#include "VCellIDASolver.h"
1616
#ifdef USE_MESSAGING
17-
static void loadJMSInfo(std::istream &ifsInput, int taskID);
17+
#include <VCELL/SimulationMessaging.h>
1818
#endif
1919
// Forward Declarations
2020
static void readDiscontinuities (std::istream &inputStream, VCellSolverInputBreakdown& inputBreakdown);
@@ -54,12 +54,7 @@ VCellSolverInputBreakdown VCellSolverFactory::parseInputFile(std::ifstream& inpu
5454
inputFileStream >> nextToken;
5555
if (nextToken.empty()) continue;
5656
if (nextToken[0] == '#') std::getline(inputFileStream, nextToken);
57-
else if (nextToken == "JMS_PARAM_BEGIN") {
58-
#ifdef USE_MESSAGING
59-
loadJMSInfo(inputFileStream, taskID);
60-
SimulationMessaging::getInstVar()->start(); // start the thread
61-
#endif
62-
} else if (nextToken == "SOLVER") {
57+
else if (nextToken == "SOLVER") {
6358
std::string solverName;
6459
inputFileStream >> solverName;
6560
inputBreakdown.solverType = determineSolverType(solverName);
@@ -112,10 +107,13 @@ VCellSolverInputBreakdown VCellSolverFactory::parseInputFile(std::ifstream& inpu
112107
}
113108

114109
VCellSolverTypes VCellSolverFactory::determineSolverType(const std::string& solverName){
115-
if (solverName == "CVODE") return VCellSolverTypes::CVODE;
116-
if (solverName == "IDA") return VCellSolverTypes::IDA;
117-
if (solverName == "CSSS") return VCellSolverTypes::STEADY_STATE; // copasi-style steady-state
118-
throw new std::runtime_error("Unknown solver type: `" + solverName + "`");
110+
if (solverName == "CVODE")
111+
return VCellSolverTypes::CVODE;
112+
if (solverName == "IDA")
113+
return VCellSolverTypes::IDA;
114+
if (solverName == "CSSS")
115+
return VCellSolverTypes::STEADY_STATE; // copasi-style steady-state
116+
throw std::runtime_error("Unknown solver type: `" + solverName + "`");
119117
}
120118

121119
void VCellSolverFactory::processEquations(std::ifstream& inputFileStream, VCellSolverInputBreakdown& inputBreakdown) {
@@ -127,51 +125,6 @@ void VCellSolverFactory::processEquations(std::ifstream& inputFileStream, VCellS
127125
* Local Helper Functions
128126
* * * * * * * * * * * * * * * * * * * * * * * * * * * **/
129127

130-
#ifdef USE_MESSAGING
131-
static void loadJMSInfo(std::istream &ifsInput, int taskID) {
132-
if (taskID < 0) {
133-
SimulationMessaging::create();
134-
return; // No need to do any parsing
135-
}
136-
std::string broker;
137-
std::string smqUserName;
138-
std::string password;
139-
std::string qName;
140-
std::string topicName;
141-
std::string vCellUsername;
142-
int simKey, jobIndex;
143-
144-
while (!ifsInput.eof()) {
145-
std::string nextToken;
146-
ifsInput >> nextToken;
147-
if (nextToken.empty()) continue;
148-
if (nextToken[0] == '#') {
149-
// std::getline(ifsInput, nextToken); // Is this ignoring because of a comment?
150-
ifsInput.ignore('\n');
151-
continue;
152-
}
153-
if (nextToken == "JMS_PARAM_END") { ifsInput.ignore(EOF); } else if (
154-
nextToken == "JMS_BROKER") { ifsInput >> broker; } else if (
155-
nextToken == "JMS_USER") { ifsInput >> smqUserName >> password; } else if (
156-
nextToken == "JMS_QUEUE") { ifsInput >> qName; } else if (
157-
nextToken == "JMS_TOPIC") { ifsInput >> topicName; } else if (nextToken == "VCELL_USER") {
158-
ifsInput >> vCellUsername;
159-
} else if (nextToken == "SIMULATION_KEY") {
160-
ifsInput >> simKey;
161-
continue;
162-
} else if (nextToken == "JOB_INDEX") {
163-
ifsInput >> jobIndex;
164-
continue;
165-
}
166-
}
167-
168-
SimulationMessaging::create(broker.c_str(), smqUserName.c_str(),
169-
password.c_str(), qName.c_str(), topicName.c_str(),
170-
vCellUsername.c_str(), simKey, jobIndex, taskID);
171-
172-
}
173-
#endif
174-
175128
static void readDiscontinuities(std::istream &inputStream, VCellSolverInputBreakdown& inputBreakdown) {
176129
VCellSolverInputBreakdown::DiscontinuityComponents discontinuityComponents;
177130
std::size_t numOfDiscontinuities;
@@ -483,7 +436,10 @@ static void loadJMSInfo(std::istream &ifsInput, int taskID) {
483436
std::string vCellUsername;
484437
int simKey, jobIndex;
485438

486-
while (!ifsInput.eof()) {
439+
while (true) {
440+
if (ifsInput.eof())
441+
throw std::runtime_error("VCellSolverFactory::loadJMSInfo() reached end of file, but no `JMS_PARAM_END` reached!");
442+
487443
std::string nextToken;
488444
ifsInput >> nextToken;
489445
if (nextToken.empty()) continue;
@@ -492,19 +448,15 @@ static void loadJMSInfo(std::istream &ifsInput, int taskID) {
492448
ifsInput.ignore('\n');
493449
continue;
494450
}
495-
if (nextToken == "JMS_PARAM_END") { ifsInput.ignore(EOF); } else if (
496-
nextToken == "JMS_BROKER") { ifsInput >> broker; } else if (
497-
nextToken == "JMS_USER") { ifsInput >> smqUserName >> password; } else if (
498-
nextToken == "JMS_QUEUE") { ifsInput >> qName; } else if (
499-
nextToken == "JMS_TOPIC") { ifsInput >> topicName; } else if (nextToken == "VCELL_USER") {
500-
ifsInput >> vCellUsername;
501-
} else if (nextToken == "SIMULATION_KEY") {
502-
ifsInput >> simKey;
503-
continue;
504-
} else if (nextToken == "JOB_INDEX") {
505-
ifsInput >> jobIndex;
506-
continue;
507-
}
451+
if (nextToken == "JMS_PARAM_END") break; // Non-error stop condition
452+
453+
if (nextToken == "JMS_BROKER") ifsInput >> broker;
454+
else if (nextToken == "JMS_USER") ifsInput >> smqUserName >> password;
455+
else if (nextToken == "JMS_QUEUE") ifsInput >> qName;
456+
else if (nextToken == "JMS_TOPIC") ifsInput >> topicName;
457+
else if (nextToken == "VCELL_USER") ifsInput >> vCellUsername;
458+
else if (nextToken == "SIMULATION_KEY") ifsInput >> simKey;
459+
else if (nextToken == "JOB_INDEX") ifsInput >> jobIndex;
508460
}
509461

510462
SimulationMessaging::create(broker.c_str(), smqUserName.c_str(),

tests/unit/resources/SimID_1489333437_0_.ida

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)