Esempio n. 1
0
int Trick::InputProcessor::process_sim_args() {

    int i ;
    int argc ;
    char ** argv ;

    argc = command_line_args_get_argc() ;
    argv = command_line_args_get_argv() ;
    input_file = command_line_args_get_input_file() ;

    /* Process all other calling arguments */
    for (i = 2; i < argc; i++) {

        /* 
         * If there are more than 2 calling arguments
         */

        if (!strncmp("-d", argv[i], (size_t) 2)) {
            /* Set the 'input verification only' and echo input flags */
            verify_input = 1 ;
        }
    }

    return(0) ;

}
Esempio n. 2
0
void Trick::MonteCarlo::initialize_slave(Trick::MonteSlave* slave_to_init) {
    std::stringstream ss;
    if (slave_to_init->remote_shell_args.empty()) {
        slave_to_init->remote_shell_args = "";
    }
    std::string buffer;
    /** <li> If this is a custom slave dispatch: add the #custom_pre_text. */
    if (custom_slave_dispatch) {
        buffer = custom_pre_text;
    /** <li> Otherwise add the default pre text.     */
    } else {
        default_slave_dispatch_pre_text(slave_to_init, buffer) ;
    }

    if (!slave_to_init->S_main_name.compare("")) {
        slave_to_init->S_main_name = "./S_main_*.exe";
    }

    /** <li> Append the S_main executable and slave-specific arguments. */
    ss << slave_to_init->S_main_name
       << " " << command_line_args_get_input_file()
       << " --monte_host " << machine_name
       << " --monte_sync_port " << listen_device.port
       << " --monte_client_id " << slave_to_init->id
       << " -O " << run_directory;
    buffer += ss.str();

    /** <li> Append user sim options. */
    if (!slave_sim_options.empty()) {
        buffer += " " + slave_sim_options;
    }

    /** <li> if this is a custom slave dispatch, append the #custom_post_text. */
    if (custom_slave_dispatch) {
        buffer += custom_post_text;
    } else {
        buffer += std::string("' &");
    }

    if (verbosity >= INFORMATIONAL) {
        message_publish(MSG_INFO, "Monte: Spawning Slave %s:%d :\n%s\n",
                        slave_to_init->machine_name.c_str(), slave_to_init->id, buffer.c_str()) ;
    }
    /** <li> Set the slave's state to INITIALIZING. */
    slave_to_init->state = MonteSlave::INITIALIZING;
    /** <li> Make the system call to execute the shell. */
    system(buffer.c_str());
}