Commit d437b38a authored by Millian Poquet's avatar Millian Poquet

Warning removal + cosmetics + bugfix (batsim.cpp)

parent b1d82595
......@@ -117,26 +117,24 @@ int parse_opt (int key, char *arg, struct argp_state *state)
}
case 'W':
{
// format: FILENAME[:start_time]
vector<string> parts;
boost::split(parts, (const std::string)std::string(arg),
boost::is_any_of(":"), boost::token_compress_on);
( mainArgs->workflowFilename ).push_back( parts.at(0).c_str() );
if (access(parts.at(0).c_str(), R_OK) == -1)
// format: FILENAME[:start_time]
vector<string> parts;
boost::split(parts, (const std::string)std::string(arg),
boost::is_any_of(":"), boost::token_compress_on);
mainArgs->workflowFilename.push_back(parts.at(0).c_str());
if (access(parts.at(0).c_str(), R_OK) == -1)
{
mainArgs->abort = true;
mainArgs->abortReason += "\n invalid WORKFLOW_FILE argument: file '" + parts.at(0) + "' cannot be read";
}
if (parts.size() == 2) {
mainArgs->workflowStartTime.push_back(std::stod(parts.at(1)));
} else {
mainArgs->workflowStartTime.push_back(0.0);
}
break;
if (parts.size() == 2)
mainArgs->workflowStartTime.push_back(std::stod(parts.at(1)));
else
mainArgs->workflowStartTime.push_back(0.0);
break;
}
case 'e':
mainArgs->exportPrefix = arg;
break;
......@@ -329,45 +327,45 @@ int main(int argc, char * argv[])
//std::list<Workload *> static_workload_list;
// string static_workload_name = "static";
for(std::list<std::string>::iterator i=mainArgs.workloadFilename.begin(); i != mainArgs.workloadFilename.end(); i++)
{
string static_workload_name_local = *i;
Workload * static_workload_local = new Workload(*i);
//static_workload_list.push_back(static_workload_local);
int nb_machines_by_workload_local = -1;
static_workload_local->load_from_json(*i, nb_machines_by_workload_local);
if( nb_machines_by_workload_local > nb_machines_by_workload )
{
nb_machines_by_workload = nb_machines_by_workload_local;
}
context.workloads.insert_workload(static_workload_name_local, static_workload_local);
string static_workload_name_local = *i;
Workload * static_workload_local = new Workload(*i);
//static_workload_list.push_back(static_workload_local);
int nb_machines_by_workload_local = -1;
static_workload_local->load_from_json(*i, nb_machines_by_workload_local);
if( nb_machines_by_workload_local > nb_machines_by_workload )
{
nb_machines_by_workload = nb_machines_by_workload_local;
}
context.workloads.insert_workload(static_workload_name_local, static_workload_local);
}
// Creating an empty placeholder workload for the workflow submitter, if needed
// if(mainArgs.workloadFilename.size()>0) {
std::list<std::string>::iterator i;
std::list<double>::iterator j;
for(i=mainArgs.workflowFilename.begin(),
j=mainArgs.workflowStartTime.begin();
i != mainArgs.workflowFilename.end(),
j != mainArgs.workflowStartTime.end();
i++,j++)
{
string workflow_workload_name = *i;
Workload * workflow_workload = new Workload(*i);
workflow_workload->jobs = new Jobs;
workflow_workload->profiles = new Profiles;
context.workloads.insert_workload(workflow_workload_name, workflow_workload);
// XBT_INFO("Creating workload %s as placeholder for %s", workflow_workload_name.c_str(), mainArgs.workflowFilename.c_str());
Workflow * file_workflow = new Workflow(*i);
file_workflow->start_time = *j;
file_workflow->load_from_xml(*i);
context.workflows.insert_workflow(workflow_workload_name, file_workflow);
}
//}
std::list<std::string>::iterator i;
std::list<double>::iterator j;
for(i=mainArgs.workflowFilename.begin(),
j=mainArgs.workflowStartTime.begin();
i != mainArgs.workflowFilename.end() && // This line was occulted by the ','. I transformed it into a '&&', remove this comment if it's ok
j != mainArgs.workflowStartTime.end();
i++,j++)
{
string workflow_workload_name = *i;
Workload * workflow_workload = new Workload(*i);
workflow_workload->jobs = new Jobs;
workflow_workload->profiles = new Profiles;
context.workloads.insert_workload(workflow_workload_name, workflow_workload);
// XBT_INFO("Creating workload %s as placeholder for %s", workflow_workload_name.c_str(), mainArgs.workflowFilename.c_str());
Workflow * file_workflow = new Workflow(*i);
file_workflow->start_time = *j;
file_workflow->load_from_xml(*i);
context.workflows.insert_workflow(workflow_workload_name, file_workflow);
}
//}
int limit_machines_count = -1;
if ((mainArgs.limit_machines_count_by_workload) && (mainArgs.limit_machines_count > 0))
limit_machines_count = min(mainArgs.limit_machines_count, nb_machines_by_workload);
......@@ -379,19 +377,9 @@ int main(int argc, char * argv[])
if (limit_machines_count != -1)
XBT_INFO("The number of machines will be limited to %d", limit_machines_count);
// XBT_INFO("Checking whether SMPI is used or not...");
// context.smpi_used = static_workload->jobs->containsSMPIJob();
// if (!context.smpi_used)
// {
XBT_INFO("SMPI will NOT be used.");
MSG_config("host/model", "ptask_L07");
// }
// else
// {
// XBT_INFO("SMPI will be used.");
// static_workload->register_smpi_applications();
// SMPI_init();
// }
// TODO: make SMPI work again
XBT_INFO("SMPI will NOT be used.");
MSG_config("host/model", "ptask_L07");
if (context.trace_schedule)
context.paje_tracer.setFilename(mainArgs.exportPrefix + "_schedule.trace");
......@@ -458,23 +446,23 @@ int main(int argc, char * argv[])
for(std::list<std::string>::iterator i=mainArgs.workloadFilename.begin(); i != mainArgs.workloadFilename.end(); i++)
{
XBT_INFO("Creating jobs_submitter process...");
JobSubmitterProcessArguments * submitterArgs = new JobSubmitterProcessArguments;
submitterArgs->context = &context;
submitterArgs->workload_name = *i;
MSG_process_create("jobs_submitter", static_job_submitter_process, (void*)submitterArgs, masterMachine->host);
XBT_INFO("The jobs_submitter process has been created.");
XBT_INFO("Creating jobs_submitter process...");
JobSubmitterProcessArguments * submitterArgs = new JobSubmitterProcessArguments;
submitterArgs->context = &context;
submitterArgs->workload_name = *i;
MSG_process_create("jobs_submitter", static_job_submitter_process, (void*)submitterArgs, masterMachine->host);
XBT_INFO("The jobs_submitter process has been created.");
}
// Creating an empty placeholder workload for the workflow submitter, if needed
for(std::list<std::string>::iterator i=mainArgs.workflowFilename.begin(); i != mainArgs.workflowFilename.end(); i++)
{
XBT_INFO("Creating workflow_submitter process...");
WorkflowSubmitterProcessArguments * submitterArgs = new WorkflowSubmitterProcessArguments;
submitterArgs->context = &context;
submitterArgs->workflow_name = *i;
MSG_process_create("workflow_submitter", workflow_submitter_process, (void*)submitterArgs, masterMachine->host);
XBT_INFO("The workflow_submitter process has been created.");
XBT_INFO("Creating workflow_submitter process...");
WorkflowSubmitterProcessArguments * submitterArgs = new WorkflowSubmitterProcessArguments;
submitterArgs->context = &context;
submitterArgs->workflow_name = *i;
MSG_process_create("workflow_submitter", workflow_submitter_process, (void*)submitterArgs, masterMachine->host);
XBT_INFO("The workflow_submitter process has been created.");
}
......
......@@ -11,6 +11,13 @@ using namespace std;
XBT_LOG_NEW_DEFAULT_CATEGORY(ipp, "ipp"); //!< Logging
/**
* @brief TODO
* @param destination_mailbox TODO
* @param type TODO
* @param data TODO
* @param detached TODO
*/
void generic_send_message(const std::string & destination_mailbox, IPMessageType type, void * data, bool detached)
{
IPMessage * message = new IPMessage;
......@@ -20,19 +27,21 @@ void generic_send_message(const std::string & destination_mailbox, IPMessageType
msg_task_t task_to_send = MSG_task_create(NULL, 0, 1e-6, message);
XBT_INFO("message from '%s' to '%s' of type '%s' with data %p",
MSG_process_get_name(MSG_process_self()), destination_mailbox.c_str(), ipMessageTypeToString(type).c_str(), data);
MSG_process_get_name(MSG_process_self()), destination_mailbox.c_str(),
ipMessageTypeToString(type).c_str(), data);
if (detached)
{
MSG_task_dsend(task_to_send, destination_mailbox.c_str(), NULL);
}
{
MSG_task_dsend(task_to_send, destination_mailbox.c_str(), NULL);
}
else
{
MSG_task_send(task_to_send, destination_mailbox.c_str());
}
{
MSG_task_send(task_to_send, destination_mailbox.c_str());
}
XBT_INFO("message from '%s' to '%s' of type '%s' with data %p done",
MSG_process_get_name(MSG_process_self()), destination_mailbox.c_str(), ipMessageTypeToString(type).c_str(), data);
MSG_process_get_name(MSG_process_self()), destination_mailbox.c_str(),
ipMessageTypeToString(type).c_str(), data);
}
void send_message(const std::string & destination_mailbox, IPMessageType type, void * data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment