extern void jag_common_init(long in_hertz) { uint32_t profile_opt; acct_gather_profile_g_get(ACCT_GATHER_PROFILE_RUNNING, &profile_opt); /* If we are profiling energy it will be checked at a different rate, so just grab the last one. */ if (profile_opt & ACCT_GATHER_PROFILE_ENERGY) energy_profile = ENERGY_DATA_STRUCT; if (in_hertz) { hertz = in_hertz; } else { hertz = sysconf(_SC_CLK_TCK); if (hertz < 1) { error ("_get_process_data: unable to get clock rate"); hertz = 100; /* default on many systems */ } } my_pagesize = getpagesize()/1024; }
/** * is lustre fs supported **/ static int _check_lustre_fs(void) { static bool set = false; static int rc = SLURM_SUCCESS; if (!set) { uint32_t profile = 0; char lustre_directory[BUFSIZ]; DIR *proc_dir; set = true; acct_gather_profile_g_get(ACCT_GATHER_PROFILE_RUNNING, &profile); if ((profile & ACCT_GATHER_PROFILE_LUSTRE)) { snprintf(lustre_directory, BUFSIZ, "%s/llite", proc_base_path); proc_dir = opendir(proc_base_path); if (!proc_dir) { error("%s: not able to read %s %m", __func__, lustre_directory); rc = SLURM_FAILURE; } else { closedir(proc_dir); } } else rc = SLURM_ERROR; } return rc; }
static int _running_profile(void) { static bool run = false; static uint32_t profile_opt = ACCT_GATHER_PROFILE_NOT_SET; if (profile_opt == ACCT_GATHER_PROFILE_NOT_SET) { acct_gather_profile_g_get(ACCT_GATHER_PROFILE_RUNNING, &profile_opt); if (profile_opt & ACCT_GATHER_PROFILE_ENERGY) run = true; } return run; }
extern int acct_gather_infiniband_p_node_update(void) { uint32_t profile; int rc = SLURM_SUCCESS; static bool set = false; static bool run = true; if (!set) { set = true; acct_gather_profile_g_get(ACCT_GATHER_PROFILE_RUNNING, &profile); if (!(profile & ACCT_GATHER_PROFILE_NETWORK)) run = false; } if (run) _update_node_infiniband(); return rc; }
static void _set_options(const int argc, char **argv) { int option_index = 0, c; log_options_t logopt = LOG_OPTS_STDERR_ONLY; char *next_str = NULL; uid_t uid = -1; static struct option long_options[] = { {"extract", no_argument, 0, 'E'}, {"help", no_argument, 0, 'h'}, {"job", required_argument, 0, 'j'}, {"input", required_argument, 0, 'i'}, {"level", required_argument, 0, 'l'}, {"node", required_argument, 0, 'N'}, {"output", required_argument, 0, 'o'}, {"profiledir", required_argument, 0, 'p'}, {"series", required_argument, 0, 's'}, {"savefiles", no_argument, 0, 'S'}, {"usage", 0, ¶ms.help, 3}, {"user", required_argument, 0, 'u'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {0, 0, 0, 0}}; log_init(xbasename(argv[0]), logopt, 0, NULL); _init_opts(); while (1) { /* now cycle through the command line */ c = getopt_long(argc, argv, "Ehi:j:l:N:o:p:s:Su:vV", long_options, &option_index); if (c == -1) break; switch (c) { case 'E': params.mode = SH5UTIL_MODE_EXTRACT; break; case 'h': params.help = 1; break; case 'i': params.input = xstrdup(optarg); break; case 'j': params.job_id = strtol(optarg, &next_str, 10); if (next_str[0] == '.') params.step_id = strtol(next_str+1, NULL, 10); break; case 'l': params.level = xstrdup(optarg); break; case 'N': params.node = xstrdup(optarg); break; case 'o': params.output = xstrdup(optarg); break; case 'p': params.dir = xstrdup(optarg); break; case 's': params.series = xstrdup(optarg); break; case 'S': params.keepfiles = 1; break; case 'u': if (uid_from_string (optarg, &uid) < 0) { error("--uid=\"%s\" invalid", optarg); exit(1); } break; case (int)'v': params.verbose++; break; case (int)'V': print_slurm_version(); exit(0); break; case ':': case '?': /* getopt() has explained it */ exit(1); } } if (params.help) { switch (params.help) { case 1: case 3: _help_msg(); break; default: fprintf(stderr, "bug: --help=%d\n", params.help); } exit(0); } if (params.job_id == -1) fatal("You need to supply a --jobs value."); if (uid == -1) uid = getuid(); params.user = uid_to_string(uid); if (!params.dir) acct_gather_profile_g_get(ACCT_GATHER_PROFILE_DIR, ¶ms.dir); if (!params.dir) fatal("You need to supply a --profiledir or be on a " "node with a valid acct_gather.conf"); if (params.verbose) { logopt.stderr_level += params.verbose; log_alter(logopt, SYSLOG_FACILITY_USER, NULL); } /* FIXME : For now all these only work for extract. Seems * like it would be easy to add the logic to "merge" as well. */ if (params.input || params.level || params.node || (params.step_id != -1) || params.series) params.mode = SH5UTIL_MODE_EXTRACT; if (params.mode == SH5UTIL_MODE_EXTRACT) { if (!params.level) params.level = xstrdup("Node:Totals"); if (!params.input) params.input = xstrdup_printf( "./job_%d.h5", params.job_id); if (!params.output) params.output = xstrdup_printf( "./extract_%d.csv", params.job_id); } if (!params.output) params.output = xstrdup_printf("./job_%d.h5", params.job_id); }