~ubuntu-branches/ubuntu/trusty/cctools/trusty-proposed

« back to all changes in this revision

Viewing changes to dttools/src/batch_job_mpi_queue.c

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2012-03-30 12:40:01 UTC
  • mfrom: (9.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120330124001-ze0lhxm5uwq2e3mo
Tags: 3.4.2-2
Added patch to handle a missing CFLAGS variable in Python's sysconfig
report (Closes: #661658).

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
batch_job_id_t batch_job_submit_mpi_queue( struct batch_queue *q, const char *cmd, const char *args, const char *infile, const char *outfile, const char *errfile, const char *extra_input_files, const char *extra_output_files )
66
66
{
67
 
        struct mpi_queue_task *t;
68
 
        char *full_command;
69
 
 
70
 
        if(infile)
71
 
                full_command = (char *) malloc((strlen(cmd) + strlen(args) + strlen(infile) + 5) * sizeof(char));
72
 
        else
73
 
                full_command = (char *) malloc((strlen(cmd) + strlen(args) + 2) * sizeof(char));
74
 
 
75
 
        if(!full_command) {
76
 
                debug(D_DEBUG, "couldn't create new work_queue task: out of memory\n");
77
 
                return -1;
 
67
        char *command = string_format("%s %s", cmd, args);
 
68
        if(infile) {
 
69
                char *new = string_format("%s <%s", infile);
 
70
                free(command);
 
71
                command = new;
78
72
        }
79
73
 
80
 
        if(infile)
81
 
                sprintf(full_command, "%s %s < %s", cmd, args, infile);
82
 
        else
83
 
                sprintf(full_command, "%s %s", cmd, args);
84
 
 
85
 
        t = mpi_queue_task_create(full_command);
86
 
 
87
 
        free(full_command);
 
74
        struct mpi_queue_task *t = mpi_queue_task_create(command);
 
75
        free(command);
88
76
 
89
77
        if(infile)
90
78
                mpi_queue_task_specify_file(t, infile, MPI_QUEUE_INPUT);