Skip to content

Commit

Permalink
Simulation Experiment view: don't check whether the memory associated…
Browse files Browse the repository at this point in the history
… with a simulation can be allocated (closes #1389).
  • Loading branch information
agarny committed Aug 8, 2017
2 parents 938bf10 + df859dc commit f4bb5c3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 57 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -38,7 +38,7 @@ var jsonData = { "versions": [
],
"changes": [
{ "change": "<strong>General:</strong> make sure that we can find the plugin 'xcb' on some Linux machines (see issue <a href=\"https://github.com/opencor/opencor/issues/1383\">#1383</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> make sure that the runtime gets updated after having edited a CellML file (see issue <a href=\"https://github.com/opencor/opencor/issues/1385\">#1385</a>)." }
{ "change": "<strong>Simulation Experiment view:</strong> make sure that the runtime gets updated after having edited a CellML file (see issue <a href=\"https://github.com/opencor/opencor/issues/1385\">#1385</a>). Don't check whether the memory associated with a simulation can be allocated (see issue <a href=\"https://github.com/opencor/opencor/issues/1389\">#1389</a>)." }
]
},
{ "major": 0, "minor": 4, "patch": 1, "day": 20, "month": 5, "year": 2015, "type": 0,
Expand Down
9 changes: 9 additions & 0 deletions doc/user/whatIsNew.js
Expand Up @@ -57,6 +57,15 @@ var jsonData = { "versions": [
}
]
},
{ "name": "Simulation",
"entries": [
{ "type": "subCategory", "name": "Simulation Experiment view (formerly known as the Single Cell view)",
"entries": [
{ "type": "Improved", "description": "Running of long simulations." }
]
}
]
},
{ "name": "Support",
"entries": [
{ "type": "subCategory", "name": "CellML support",
Expand Down
Expand Up @@ -426,12 +426,8 @@
<translation>Les paramètres suivants sont importés et ne peuvent donc pas être sauvegardés :</translation>
</message>
<message>
<source>The simulation requires %1 of memory and you have only %2 left.</source>
<translation>La simulation requiert %1 de mémoire et il ne vous en reste que %2.</translation>
</message>
<message>
<source>We could not allocate the %1 of memory required for the simulation.</source>
<translation>Nous n&apos;avons pas pu allouer les %1 de mémoire nécessaires pour la simulation.</translation>
<source>We could not allocate the memory required for the simulation.</source>
<translation>Nous n&apos;avons pas pu allouer la mémoire nécessaire pour la simulation.</translation>
</message>
<message>
<source>Export To SED-ML File</source>
Expand Down
Expand Up @@ -1272,35 +1272,21 @@ void SimulationExperimentViewSimulationWidget::runPauseResumeSimulation()
if (mSimulation->isPaused()) {
mSimulation->resume();
} else {
// Check that we have enough memory to run our simulation
// Try to allocate all the memory we need for the simulation by
// resetting its settings

bool runSimulation = true;
bool runSimulation = mSimulation->results()->reset();

double freeMemory = Core::freeMemory();
double requiredMemory = mSimulation->requiredMemory();

if (requiredMemory > freeMemory) {
Core::warningMessageBox(tr("Run Simulation"),
tr("The simulation requires %1 of memory and you have only %2 left.").arg(Core::sizeAsString(requiredMemory), Core::sizeAsString(freeMemory)));
} else {
// Theoretically speaking, we have enough memory to run the
// simulation, so try to allocate all the memory we need for the
// simulation by resetting its settings

runSimulation = mSimulation->results()->reset();
// Run our simulation (after having cleared our plots), in case we
// were able to allocate all the memory we need

if (runSimulation) {
mViewWidget->checkSimulationResults(mFileName, true);
// Note: this will, among other things, clear our plots...

// Effectively run our simulation in case we were able to
// allocate all the memory we need to run the simulation

if (runSimulation) {
mSimulation->run();
} else {
Core::warningMessageBox(tr("Run Simulation"),
tr("We could not allocate the %1 of memory required for the simulation.").arg(Core::sizeAsString(requiredMemory)));
}
mSimulation->run();
} else {
Core::warningMessageBox(tr("Run Simulation"),
tr("We could not allocate the memory required for the simulation."));
}

handlingAction = false;
Expand Down
24 changes: 0 additions & 24 deletions src/plugins/support/SimulationSupport/src/simulation.cpp
Expand Up @@ -1078,30 +1078,6 @@ void Simulation::setDelay(const int &pDelay)

//==============================================================================

double Simulation::requiredMemory()
{
// Determine and return the amount of required memory to run our simulation
// Note #1: we return the amount as a double rather than a qulonglong (as we
// do when retrieving the total/free amount of memory available;
// see [OpenCOR]/src/plugins/miscellaneous/Core/src/guiutils.cpp)
// in case a simulation requires an insane amount of memory...
// Note #2: the 1.0 is for mPoints in SimulationResults...

if (mRuntime) {
return size()
*( 1.0
+mRuntime->constantsCount()
+mRuntime->ratesCount()
+mRuntime->statesCount()
+mRuntime->algebraicCount())
*Solver::SizeOfDouble;
} else {
return 0.0;
}
}

//==============================================================================

bool Simulation::simulationSettingsOk(const bool &pEmitSignal)
{
// Check and return whether our simulation settings are sound
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/support/SimulationSupport/src/simulation.h
Expand Up @@ -258,8 +258,6 @@ class SIMULATIONSUPPORT_EXPORT Simulation : public QObject
int delay() const;
void setDelay(const int &pDelay);

double requiredMemory();

double size();

bool run();
Expand Down

0 comments on commit f4bb5c3

Please sign in to comment.