Allow specification of MC slave output directory

Refs #763
This commit is contained in:
Derek Bankieris 2019-05-06 11:32:12 -05:00
parent 3364cd3836
commit 7d7b461b38
4 changed files with 11 additions and 2 deletions

View File

@ -259,6 +259,9 @@ namespace Trick {
/** Options to be passed to the slave sim. */
std::string slave_sim_options;
/** Base output directory for slaves. */
std::string slave_output_directory;
private:
int run_queue(Trick::ScheduledJobQueue* queue, std::string in_string) ;

View File

@ -19,7 +19,7 @@ void Trick::MonteCarlo::dispatch_run_to_slave(MonteRun *run, MonteSlave *slave)
connection_device.port = slave->port;
if (tc_connect(&connection_device) == TC_SUCCESS) {
std::stringstream buffer_stream;
buffer_stream << run_directory << "/RUN_" << std::setw(5) << std::setfill('0') << run->id;
buffer_stream << slave_output_directory << "/RUN_" << std::setw(5) << std::setfill('0') << run->id;
std::string buffer = "";
for (std::vector<std::string>::size_type j = 0; j < run->variables.size(); ++j) {
buffer += run->variables[j] + "\n";

View File

@ -34,6 +34,12 @@ int Trick::MonteCarlo::construct_run_directory() {
return -1;
}
run_directory = run_base_directory + "MONTE_" + run_directory;
// If the user hasn't set an output directory for slaves, default to
// the same location as the master's output.
if (slave_output_directory.empty()) {
slave_output_directory = run_directory;
}
}
if (access(run_directory.c_str(), F_OK) != 0) {

View File

@ -49,7 +49,7 @@ void Trick::MonteCarlo::initialize_slave(Trick::MonteSlave* slave_to_init) {
<< " --monte_host " << machine_name
<< " --monte_sync_port " << listen_device.port
<< " --monte_client_id " << slave_to_init->id
<< " -O " << run_directory;
<< " -O " << slave_output_directory;
buffer += ss.str();
/** <li> Append user sim options. */