/******************************************************
* LSBLIB -- Examples
*
* lsb_submit()
* Use lsb_submit() in the simplest way with error
* checking
*****************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <lsf/lsbatch.h>
#include "combine_arg.h"
/* To use the function "combine_arg" to combine arguments on the command line include its header file "combine_arg.h". */
int main(int argc, char **argv)
{
int i;
struct submit req; /* job specifications */
memset(&req, 0, sizeof(req)); /* initializes req */
struct submitReply reply; /* results of job submission */
int jobId; /* job ID of submitted job
*/
/* Check the return value of lsb_init() to ensure that the initialization of LSBLIB is successful. */
if (lsb_init(argv[0]) < 0) {
sb_perror("simbsub: lsb_init() failed");
l exit(-1);
}
/* Check if the input is in the correct format: "./simbsub COMMAND [ARGUMENTS]"
(simbsub is the name of this executable program). */
if (argc < 2) {
fprintf(stderr, "Usage: simbsub command\n");
exit(-1);
}
req.options = 0; /* Set options and options2 to 0 */
req.options2 = 0; /* to indicate no options are selected */
req.beginTime = 0; /* Set beginTime to 0 to dispatch job without delay */
req.termTime = 0; /* Set termTime to 0 to indicate no terminating deadline */
/* Set Resource limits to default*/
for (i = 0; i < LSF_RLIM_NLIMITS; i++)
req.rLimits[i] = DEFAULT_RLIMIT;
/*Initialize the initial number and maximum number of processors needed by a (parallel) job*/
req.numProcessors = 1;
req.maxNumProcessors = 1;
req.command = combine_arg(argc,argv); /* Initialize command line of job */
printf("----------------------------------------------\n");
jobId = lsb_submit(&req, &reply); /*submit the job with specifications */
exit(0);
} /* main */