-
Notifications
You must be signed in to change notification settings - Fork 30
/
pyxis_alloc.c
59 lines (45 loc) · 1.01 KB
/
pyxis_alloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "pyxis_alloc.h"
#include "args.h"
#include "config.h"
struct plugin_context {
struct plugin_args *args;
};
static struct plugin_context context = {
.args = NULL,
};
int pyxis_alloc_init(spank_t sp, int ac, char **av)
{
int ret;
struct plugin_config config;
ret = pyxis_config_parse(&config, ac, av);
if (ret < 0) {
slurm_error("pyxis: failed to parse configuration");
return (-1);
}
if (!config.sbatch_support)
return (0);
context.args = pyxis_args_register(sp);
if (context.args == NULL) {
slurm_error("pyxis: failed to register arguments");
return (-1);
}
return (0);
}
int pyxis_alloc_post_opt(spank_t sp, int ac, char **av)
{
/* Calling pyxis_args_enabled() for arguments validation */
pyxis_args_enabled();
return (0);
}
int pyxis_alloc_exit(spank_t sp, int ac, char **av)
{
pyxis_args_free();
memset(&context, 0, sizeof(context));
return (0);
}