Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
2c449034
Commit
2c449034
authored
18 years ago
by
Christopher J. Morrone
Browse files
Options
Downloads
Patches
Plain Diff
Remove outdated step context example.
parent
f4288f96
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/man/man3/slurm_step_ctx_create.3
+2
-159
2 additions, 159 deletions
doc/man/man3/slurm_step_ctx_create.3
with
2 additions
and
159 deletions
doc/man/man3/slurm_step_ctx_create.3
+
2
−
159
View file @
2c449034
...
@@ -190,165 +190,8 @@ On error, \-1 is returned, and the Slurm error code is set appropriately.
...
@@ -190,165 +190,8 @@ On error, \-1 is returned, and the Slurm error code is set appropriately.
SLURM controller.
SLURM controller.
.SH "EXAMPLE
.SH "EXAMPLE
.LP
.LP
#include <signal.h>
SEE \fBslurm_step_launch\fR(3) man page for an example of slurm_step_ctx_create
.br
and slurm_step_launch in use together.
#include <stdio.h>
.br
#include <stdlib.h>
.br
#include <string.h>
.br
#include <unistd.h>
.br
#include <sys/types.h>
.br
#include <slurm/slurm.h>
.br
#include <slurm/slurm_errno.h>
.LP
static int *_build_socket_array(int nodes);
.br
static void _do_task_work(int *fd_array, int nodes);
.LP
int main (int argc, char *argv[])
.br
{
.br
int i, j, nodes = 1, tasks;
.br
job_desc_msg_t job_req;
.br
resource_allocation_response_msg_t *job_resp;
.br
job_step_create_request_msg_t; step_req;
.br
slurm_step_ctx ctx;
.br
char *task_argv[2];
.br
int *fd_array;
.br
uint32_t *task_cnt; *tid;
.LP
if (argc > 1) {
.br
i = atoi(argv[1]);
.br
if (i > 0)
.br
nodes = i;
.br
}
.br
tasks = nodes;
.LP
/* Create a job allocation */
.br
slurm_init_job_desc_msg( &job_req );
.br
job_req.min_nodes = nodes;
.br
if (slurm_allocate_resources(&job_req, &job_resp)) {
.br
slurm_perror ("slurm_allocate_resources error");
.br
exit (1);
.br
}
.LP
/* Set up step configuration */
.br
bzero(&step_req, sizeof(job_step_create_request_msg_t ));
.br
step_req.job_id = job_resp\->job_id;
.br
step_req.user_id = getuid();
.br
step_req.node_count = nodes;
.br
step_req.num_tasks = tasks;
.br
step_req.num_tasks = nodes;
.br
ctx = slurm_step_ctx_create(&step_req);
.br
if (ctx == NULL) {
.br
slurm_perror("slurm_step_ctx_create");
.br
exit(1);
.br
}
.LP
task_argv[0] = "/bin/hostname";
.br
if (slurm_step_ctx_set(ctx, SLURM_STEP_CTX_ARGS,
.br
1, &task_argv))
.br
slurm_perror("slurm_step_ctx_create");
.br
fd_array = _build_socket_array(tasks);
.LP
/* Spawn the tasks */
.br
if (slurm_spawn(ctx, fd_array)) {
.br
slurm_perror("slurm_spawn");
.br
slurm_kill_job(job_resp\->job_id, SIGKILL, 0);
.br
exit(1);
.br
}
.LP
printf("Started %d tasks on %d nodes\\n",
.br
step_req.num_tasks, step_req.node_count);
.br
if (slurm_step_ctx_get(ctx, SLURM_STEP_CTX_TASKS, &task_cnt)) {
.br
slurm_perror("slurm_step_ctx_create");
.br
exit(1);
.br
}
.br
for (i=0; i<step_req.node_count; i++) {
.br
if (slurm_step_ctx_get(ctx, SLURM_STEP_CTX_TID, i, &tid)) {
.br
slurm_perror("slurm_step_ctx_create");
.br
exit(1);
.br
}
.br
for (j=0; j<task_cnt[i]; j++)
.br
printf("tid[%d][%d] = %u\\n", i, j, tid[j]);
.br
.LP
/* Interact with spawned tasks as desired */
.br
_do_task_work(fd_array, tasks);
.LP
if (slurm_spawn_kill(ctx, SIGKILL))
.br
slurm_perror("slurm_spawn_kill");
.LP
/* Terminate the job killing all tasks */
.br
slurm_kill_job(job_resp\->job_id, SIGKILL, 0);
.br
slurm_step_ctx_destroy(ctx);
.br
slurm_free_resource_allocation_response_msg(job_resp);
.br
exit (0);
.br
}
.SH "NOTE"
.SH "NOTE"
These functions are included in the libslurm library,
These functions are included in the libslurm library,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment