What you have done using the APIs is create a job allocation. Launching tasks on compute nodes is something that I would not recommend doing using the APIs since handling the I/O buffering, signal forwarding, capturing exit codes, etc. is very complex. You can see that code in SLURM's srun command "src/srun". Executing the srun command rather than using the APIs will almost certainly be much simpler for you. If you need to use the APIs, then I would recommend starting with the srun code and modifying it as needed.
Quoting Palaniappa Manivasagam <palania...@gmail.com>: [Hide Quoted Text] Hi I am new to slurm. I have to submit a job using slurm api. A sample code snippet will be really helpful. The following is what i have so far job_desc_msg_t jobInfo; slurm_init_job_desc_msg(&jobInfo); jobInfo.alloc_node = host; jobInfo.argc = 1; jobInfo.argv = (char**) malloc(sizeof(char*)*jobInfo.argc); jobInfo.argv[0] = (char*) malloc(strlen("ls"); strcpy(jobInfo.argv[0],"ls"); jobInfo.req_nodes = (char*) malloc(MAX_HOST_NAME_LEN+1); strcpy(jobInfo.req_nodes,"ubuntu"); jobInfo.immediate = 0; jobInfo.user_id = getuid(); jobInfo.group_id = getgid(); jobInfo.name = (char*) malloc(MAX_HOST_NAME_LEN+1); strcpy(jobInfo.name,"job1"); //jobInfo.work_dir = (char*) malloc(100); //strcpy(jobInfo.work_dir,"/home/administrator/OsAssignment2"); //printf("Allocation to host %s %s\n",jobInfo.req_nodes,jobInfo.argv[0]); resource_allocation_response_msg_t* allocResponse = NULL; int retVal = slurm_allocate_resources(&jobInfo,&allocResponse); printf("\nAlloc ret %d",retVal); if(!retVal) { printf("Job allocation looks ok\n"); After executing this i am able to see the job with running status in sview. However i don't think it runs. -- Thanks Palani