Skip to content

Commit

Permalink
Fix Simulation Cores in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Feb 7, 2023
1 parent 813e2c0 commit 11a8564
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/libs/antares/study/parallel-years.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,12 @@ void SetsOfParallelYearCalculator::computeRawNbParallelYear()

try
{
forcedNbOfParallelYears_ = numberOfMCYearThreads.at(p.nbCores.ncMode);
rawNbOfParallelYears_ = numberOfMCYearThreads.at(p.nbCores.ncMode);
}
catch(const std::out_of_range& e)
{
logs.fatal() << "Simulation cores level not correct : " << (int)p.nbCores.ncMode;
logs.fatal() << "Simulation cores level not correct : " << static_cast<int>(p.nbCores.ncMode);
}

}


Expand All @@ -244,7 +243,7 @@ void SetsOfParallelYearCalculator::limitNbOfParallelYearsbyMinRefreshSpan()
if ((p.timeSeriesToGenerate & timeSeriesThermal) && (p.timeSeriesToRefresh & timeSeriesThermal))
TSlimit = std::min(p.refreshIntervalThermal, TSlimit);

forcedNbOfParallelYears_ = std::min({p.nbYears, TSlimit, forcedNbOfParallelYears_});
forcedNbOfParallelYears_ = std::min({p.nbYears, TSlimit, rawNbOfParallelYears_});
}

bool SetsOfParallelYearCalculator::isRefreshNeededForCurrentYear(uint y)
Expand Down Expand Up @@ -370,7 +369,6 @@ void SetsOfParallelYearCalculator::buildSetsOfParallelYears()
// End of loop over years

}

}


Expand Down
6 changes: 6 additions & 0 deletions src/libs/antares/study/parallel-years.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ class SetsOfParallelYearCalculator
return forcedNbOfParallelYears_;
}

[[nodiscard]] uint getRawNbParallelYearsForGUI() const
{
return rawNbOfParallelYears_;
}

[[nodiscard]] uint getMinNbParallelYearsForGUI() const
{
return computeMinNbParallelYears();
Expand Down Expand Up @@ -155,6 +160,7 @@ class SetsOfParallelYearCalculator
bool forceParallel_;
bool enableParallel_;
uint forcedNbOfParallelYears_;
uint rawNbOfParallelYears_;
uint number_of_cores_;
bool thermalTSRefresh_;
Parameters& p;
Expand Down
6 changes: 4 additions & 2 deletions src/libs/antares/study/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,18 @@ uint64 Study::memoryUsage() const

void Study::getNumberOfCores(const bool forceParallel, const bool enableParallel, const uint nbYearsParallelForced) {

TempAreaListHolder holder{};
TempAreaListHolder holder;
bool thermalTSRefresh = holder.checkThermalTSGeneration(folderInput);

SetsOfParallelYearCalculator setsBuilder(forceParallel,
enableParallel,
nbYearsParallelForced, Yuni::System::CPU::Count(),
nbYearsParallelForced,
Yuni::System::CPU::Count(),
thermalTSRefresh,
parameters);
// For GUI
minNbYearsInParallel_save = setsBuilder.getMinNbParallelYearsForGUI();
nbYearsParallelRaw = setsBuilder.getRawNbParallelYearsForGUI();
maxNbYearsInParallel_save = setsBuilder.getForcedNbOfParallelYears();

// For the solver
Expand Down

0 comments on commit 11a8564

Please sign in to comment.