1
1

Merge pull request #2096 from rhc54/topic/cruft

Clean out old cruft from the ORCM project
Этот коммит содержится в:
rhc54 2016-09-21 09:31:01 -05:00 коммит произвёл GitHub
родитель 505be0ebaf de7b1494d9
Коммит e1d89a4dcf
16 изменённых файлов: 17 добавлений и 935 удалений

Просмотреть файл

@ -268,8 +268,7 @@ static int orte_iof_base_open(mca_base_open_flag_t flags)
} }
/* daemons do not need to do this as they do not write out stdout/err */ /* daemons do not need to do this as they do not write out stdout/err */
if (!ORTE_PROC_IS_DAEMON || if (!ORTE_PROC_IS_DAEMON) {
(ORTE_PROC_IS_DAEMON && ORTE_PROC_IS_CM)) {
if (orte_xml_output) { if (orte_xml_output) {
if (NULL != orte_xml_fp) { if (NULL != orte_xml_fp) {
/* user wants all xml-formatted output sent to file */ /* user wants all xml-formatted output sent to file */

Просмотреть файл

@ -49,11 +49,7 @@ int orte_iof_base_select(void)
&orte_iof_base_framework.framework_components, &orte_iof_base_framework.framework_components,
(mca_base_module_t **) &best_module, (mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component, NULL) ) { (mca_base_component_t **) &best_component, NULL) ) {
/* it is okay to not find a module if we are a CM process */ /* this is a problem */
if (ORTE_PROC_IS_CM) {
return ORTE_SUCCESS;
}
/* otherwise, this is a problem */
return ORTE_ERR_NOT_FOUND; return ORTE_ERR_NOT_FOUND;
} }

Просмотреть файл

@ -192,7 +192,7 @@ static int create_listen(void)
* port in the range. Otherwise, tcp_port_min will be 0, which * port in the range. Otherwise, tcp_port_min will be 0, which
* means "pick any port" * means "pick any port"
*/ */
if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_AGGREGATOR) { if (ORTE_PROC_IS_DAEMON) {
if (NULL != mca_oob_tcp_component.tcp_static_ports) { if (NULL != mca_oob_tcp_component.tcp_static_ports) {
/* if static ports were provided, take the /* if static ports were provided, take the
* first entry in the list * first entry in the list
@ -209,7 +209,7 @@ static int create_listen(void)
opal_argv_append_nosize(&ports, "0"); opal_argv_append_nosize(&ports, "0");
orte_static_ports = false; orte_static_ports = false;
} }
} else if (ORTE_PROC_IS_HNP || ORTE_PROC_IS_SCHEDULER) { } else if (ORTE_PROC_IS_HNP) {
if (NULL != mca_oob_tcp_component.tcp_static_ports) { if (NULL != mca_oob_tcp_component.tcp_static_ports) {
/* if static ports were provided, take the /* if static ports were provided, take the
* first entry in the list * first entry in the list

Просмотреть файл

@ -1321,11 +1321,10 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
opal_argv_append(argc, argv, "orte_report_bindings"); opal_argv_append(argc, argv, "orte_report_bindings");
opal_argv_append(argc, argv, "1"); opal_argv_append(argc, argv, "1");
} }
if (!ORTE_PROC_IS_CM) { /* pass our topology signature */
/* pass our topology signature */ opal_argv_append(argc, argv, "--hnp-topo-sig");
opal_argv_append(argc, argv, "--hnp-topo-sig"); opal_argv_append(argc, argv, orte_topo_signature);
opal_argv_append(argc, argv, orte_topo_signature);
}
if (orte_hetero_nodes) { if (orte_hetero_nodes) {
opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID);
opal_argv_append(argc, argv, "orte_hetero_nodes"); opal_argv_append(argc, argv, "orte_hetero_nodes");

Просмотреть файл

@ -606,17 +606,10 @@ static int setup_launch(int *argcptr, char ***argvptr,
* Add the basic arguments to the orted command line, including * Add the basic arguments to the orted command line, including
* all debug options * all debug options
*/ */
if (ORTE_PROC_IS_CM) { orte_plm_base_orted_append_basic_args(&argc, &argv,
orte_plm_base_orted_append_basic_args(&argc, &argv, "env",
NULL, proc_vpid_index,
proc_vpid_index, NULL);
NULL);
} else {
orte_plm_base_orted_append_basic_args(&argc, &argv,
"env",
proc_vpid_index,
NULL);
}
/* ensure that only the ssh plm is selected on the remote daemon */ /* ensure that only the ssh plm is selected on the remote daemon */
opal_argv_append_nosize(&argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append_nosize(&argv, "-"OPAL_MCA_CMD_LINE_ID);

Просмотреть файл

@ -1,36 +0,0 @@
#
# Copyright (c) 2014 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
dist_ortedata_DATA = help-rtc-freq.txt
sources = \
rtc_freq.c \
rtc_freq.h \
rtc_freq_component.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_rtc_freq_DSO
component_noinst =
component_install = mca_rtc_freq.la
else
component_noinst = libmca_rtc_freq.la
component_install =
endif
mcacomponentdir = $(ortelibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_rtc_freq_la_SOURCES = $(sources)
mca_rtc_freq_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_rtc_freq_la_SOURCES =$(sources)
libmca_rtc_freq_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,23 +0,0 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# MCA_rtc_freq_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_rtc_freq_CONFIG], [
AC_CONFIG_FILES([orte/mca/rtc/freq/Makefile])
# do not build if not on linux
AC_MSG_CHECKING([for freq control support])
AS_IF([test "$opal_found_linux" = "yes"],
[AC_MSG_RESULT([yes])
$1],
[AC_MSG_RESULT([only supported on Linux systems])
$2])
])dnl

Просмотреть файл

@ -1,62 +0,0 @@
# Copyright (c) 2014 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
[conflict-freq]
A specific frequency was given along with either or both a maximum
and minimum frequency. If a specific frequency is given, then the
max/min cannot be specified as well.
Freq: %s
Max freq: %s
Min freq: %s
Please correct the situation and try again.
#
[req-dir-not-found]
The frequency control component cannot function as a required directory
was not found on at least one node:
Node: %s
Dir: %s
The component cannot operate and has been disabled.
#
[no-cores-found]
The frequency control component did not find any cores on at least one node:
Node: %s
The component cannot operate and has been disabled.
#
[unsupported-governor]
A frequency governor was specified that is not supported on at least
one node:
Node: %s
Governor: %s
Available: %s
Please select one of the available governors and try again.
#
[permission-denied]
An attempt to open a file required for setting the specified
%s value has failed on at least one node:
Node: %s
Filename: %s
Check file permissions and try again.
#
[unsupported-freq]
A frequency was specified that is not supported on at least
one node:
Node: %s
Freq: %s
Available: %s
Please select one of the available frequencies and try again.

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner: INTEL
status: maintenance

Просмотреть файл

@ -1,610 +0,0 @@
/*
* Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "orte/types.h"
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <string.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif /* HAVE_DIRENT_H */
#include <ctype.h>
#include "opal/class/opal_list.h"
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/util/os_path.h"
#include "opal/util/output.h"
#include "opal/util/os_dirpath.h"
#include "orte/util/show_help.h"
#include "orte/util/error_strings.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rmaps/rmaps_types.h"
#include "orte/mca/rtc/base/base.h"
#include "rtc_freq.h"
static int init(void);
static void finalize(void);
static void assign(orte_job_t *jdata);
static void set(orte_job_t *jdata,
orte_proc_t *proc,
char ***environ_copy,
int write_fd);
static void getvals(opal_list_t *vals);
orte_rtc_base_module_t orte_rtc_freq_module = {
init,
finalize,
assign,
set,
getvals
};
typedef struct {
opal_list_item_t super;
int core;
char *directory;
/* save the system settings so we can restore them when we die */
char *system_governor;
float system_max_freq;
float system_min_freq;
/* save the current settings so we only change them when required */
char *current_governor;
float current_max_freq;
float current_min_freq;
/* keep a list of allowed values */
opal_list_t governors;
opal_list_t frequencies;
/* mark if setspeed is supported */
bool setspeed;
} rtefreq_tracker_t;
static void ctr_con(rtefreq_tracker_t *trk)
{
trk->directory = NULL;
trk->system_governor = NULL;
trk->current_governor = NULL;
OBJ_CONSTRUCT(&trk->governors, opal_list_t);
OBJ_CONSTRUCT(&trk->frequencies, opal_list_t);
trk->setspeed = false;
}
static void ctr_des(rtefreq_tracker_t *trk)
{
if (NULL != trk->directory) {
free(trk->directory);
}
if (NULL != trk->system_governor) {
free(trk->system_governor);
}
if (NULL != trk->current_governor) {
free(trk->current_governor);
}
OPAL_LIST_DESTRUCT(&trk->governors);
OPAL_LIST_DESTRUCT(&trk->frequencies);
}
OBJ_CLASS_INSTANCE(rtefreq_tracker_t,
opal_list_item_t,
ctr_con, ctr_des);
static char *orte_getline(FILE *fp)
{
char *ret, *buff;
char input[1024];
int k;
ret = fgets(input, 1024, fp);
if (NULL != ret) {
/* trim the end of the line */
for (k=strlen(input)-1; 0 < k && isspace(input[k]); k--) {
input[k] = '\0';
}
buff = strdup(input);
return buff;
}
return NULL;
}
static opal_list_t tracking;
static int init(void)
{
int k;
DIR *cur_dirp = NULL;
struct dirent *entry;
char *filename, *tmp, **vals;
FILE *fp;
rtefreq_tracker_t *trk;
opal_value_t *kv;
/* always construct this so we don't segfault in finalize */
OBJ_CONSTRUCT(&tracking, opal_list_t);
/*
* Open up the base directory so we can get a listing
*/
if (NULL == (cur_dirp = opendir("/sys/devices/system/cpu"))) {
OBJ_DESTRUCT(&tracking);
if (4 < opal_output_get_verbosity(orte_rtc_base_framework.framework_output)) {
orte_show_help("help-rtc-freq.txt", "req-dir-not-found",
true, orte_process_info.nodename,
"/sys/devices/system/cpu");
}
return ORTE_ERROR;
}
/*
* For each directory
*/
while (NULL != (entry = readdir(cur_dirp))) {
/*
* Skip the obvious
*/
if (0 == strncmp(entry->d_name, ".", strlen(".")) ||
0 == strncmp(entry->d_name, "..", strlen(".."))) {
continue;
}
/* look for cpu directories */
if (0 != strncmp(entry->d_name, "cpu", strlen("cpu"))) {
/* cannot be a cpu directory */
continue;
}
/* if it ends in other than a digit, then it isn't a cpu directory */
if (!isdigit(entry->d_name[strlen(entry->d_name)-1])) {
continue;
}
/* track the info for this core */
trk = OBJ_NEW(rtefreq_tracker_t);
/* trailing digits are the core id */
for (k=strlen(entry->d_name)-1; 0 <= k; k--) {
if (!isdigit(entry->d_name[k])) {
break;
}
}
trk->core = strtoul(&entry->d_name[k], NULL, 10);
trk->directory = opal_os_path(false, "/sys/devices/system/cpu", entry->d_name, "cpufreq", NULL);
/* read/save the current settings */
filename = opal_os_path(false, trk->directory, "scaling_governor", NULL);
if (NULL == (fp = fopen(filename, "rw"))) {
free(filename);
OBJ_RELEASE(trk);
continue;
}
trk->system_governor = orte_getline(fp);
trk->current_governor = strdup(trk->system_governor);
fclose(fp);
free(filename);
filename = opal_os_path(false, trk->directory, "scaling_max_freq", NULL);
if (NULL == (fp = fopen(filename, "rw"))) {
free(filename);
OBJ_RELEASE(trk);
continue;
}
tmp = orte_getline(fp);
fclose(fp);
trk->system_max_freq = strtoul(tmp, NULL, 10) / 1000000.0;
trk->current_max_freq = trk->system_max_freq;
free(filename);
free(tmp);
filename = opal_os_path(false, trk->directory, "scaling_min_freq", NULL);
if (NULL == (fp = fopen(filename, "rw"))) {
free(filename);
OBJ_RELEASE(trk);
continue;
}
tmp = orte_getline(fp);
fclose(fp);
trk->system_min_freq = strtoul(tmp, NULL, 10) / 1000000.0;
trk->current_min_freq = trk->system_min_freq;
free(filename);
free(tmp);
/* get the list of available governors */
filename = opal_os_path(false, trk->directory, "scaling_available_governors", NULL);
if (NULL == (fp = fopen(filename, "r"))) {
free(filename);
OBJ_RELEASE(trk);
continue;
}
tmp = orte_getline(fp);
fclose(fp);
free(filename);
if (NULL != tmp) {
vals = opal_argv_split(tmp, ' ');
free(tmp);
for (k=0; NULL != vals[k]; k++) {
kv = OBJ_NEW(opal_value_t);
kv->type = OPAL_STRING;
kv->data.string = strdup(vals[k]);
opal_list_append(&trk->governors, &kv->super);
}
opal_argv_free(vals);
}
/* get the list of available frequencies */
filename = opal_os_path(false, trk->directory, "scaling_available_frequencies", NULL);
if (NULL == (fp = fopen(filename, "r"))) {
free(filename);
OBJ_RELEASE(trk);
continue;
}
tmp = orte_getline(fp);
fclose(fp);
free(filename);
if (NULL != tmp) {
vals = opal_argv_split(tmp, ' ');
free(tmp);
for (k=0; NULL != vals[k]; k++) {
kv = OBJ_NEW(opal_value_t);
kv->type = OPAL_FLOAT;
kv->data.fval = strtoul(vals[k], NULL, 10) / 1000000.0;
opal_list_append(&trk->frequencies, &kv->super);
}
opal_argv_free(vals);
}
/* see if setspeed is supported */
filename = opal_os_path(false, trk->directory, "scaling_setspeed", NULL);
if (NULL != (fp = fopen(filename, "rw"))) {
trk->setspeed = true;
fclose(fp);
}
free(filename);
/* add to our list */
opal_list_append(&tracking, &trk->super);
}
closedir(cur_dirp);
if (0 == opal_list_get_size(&tracking)) {
/* nothing to read */
if (0 < opal_output_get_verbosity(orte_rtc_base_framework.framework_output)) {
orte_show_help("help-rtc-freq.txt", "no-cores-found",
true, orte_process_info.nodename);
}
OPAL_LIST_DESTRUCT(&tracking);
return ORTE_ERROR;
}
/* report out the results, if requested */
if (9 < opal_output_get_verbosity(orte_rtc_base_framework.framework_output)) {
OPAL_LIST_FOREACH(trk, &tracking, rtefreq_tracker_t) {
opal_output(0, "%s\tCore: %d Governor: %s MaxFreq: %f MinFreq: %f\n",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), trk->core,
trk->system_governor, trk->system_max_freq, trk->system_min_freq);
OPAL_LIST_FOREACH(kv, &trk->governors, opal_value_t) {
opal_output(0, "%s\t\tGovernor: %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), kv->data.string);
}
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
opal_output(0, "%s\t\tFrequency: %f",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), kv->data.fval);
}
}
}
return ORTE_SUCCESS;
}
static void finalize(void)
{
OPAL_LIST_DESTRUCT(&tracking);
return;
}
static void assign(orte_job_t *jdata)
{
bool freq_given = false;
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning freq controls to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
/* see if the job already has the max freq attribute set */
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_MAX_FREQ, NULL, OPAL_STRING)) {
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning max freq given for job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
freq_given = true;
} else if (NULL != mca_rtc_freq_component.max_freq) {
/* if not, set the default value if provided */
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning default max freq control to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
orte_set_attribute(&jdata->attributes, ORTE_JOB_MAX_FREQ, ORTE_ATTR_GLOBAL,
mca_rtc_freq_component.max_freq, OPAL_STRING);
freq_given = true;
}
/* see if the job already has the min freq attribute set */
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_MIN_FREQ, NULL, OPAL_STRING)) {
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning min freq controls to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
freq_given = true;
} else if (NULL != mca_rtc_freq_component.min_freq) {
/* if not, set the default value if provided */
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning default minfreq controls to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
orte_set_attribute(&jdata->attributes, ORTE_JOB_MIN_FREQ, ORTE_ATTR_GLOBAL,
mca_rtc_freq_component.min_freq, OPAL_STRING);
freq_given = true;
}
/* see if the job has a governor attribute set */
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_GOVERNOR, NULL, OPAL_STRING)) {
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning freq governor to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
/* if not, was a default value provided? */
if (NULL != mca_rtc_freq_component.governor) {
/* set it */
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning default freq governor to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
orte_set_attribute(&jdata->attributes, ORTE_JOB_GOVERNOR, ORTE_ATTR_GLOBAL,
mca_rtc_freq_component.governor, OPAL_STRING);
} else if (freq_given) {
/* if the user specified a frequency, then we should default
* to the userspace governor to ensure we can set it */
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Assigning default userspace governor to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
orte_set_attribute(&jdata->attributes, ORTE_JOB_GOVERNOR, ORTE_ATTR_GLOBAL,
"userspace", OPAL_STRING);
}
}
}
static void set(orte_job_t *jdata,
orte_proc_t *child,
char ***environ_copy,
int write_fd)
{
char *governor, *tmp, **vals;
rtefreq_tracker_t *trk;
opal_value_t *kv;
float freq, *fptr, minfreq;
bool setspeed_used = false;
bool allowed;
char *filename;
FILE *fp;
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Setting freq controls for job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_JOBID_PRINT(jdata->jobid));
/* see if the job has the governor attribute set */
governor = NULL;
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_GOVERNOR, (void**)&governor, OPAL_STRING)) {
/* loop thru all the cpus on this node */
OPAL_LIST_FOREACH(trk, &tracking, rtefreq_tracker_t) {
/* does the requested value match the current setting? */
if (0 == strcmp(trk->current_governor, governor)) {
continue;
}
/* is the specified governor among those allowed? */
allowed = false;
OPAL_LIST_FOREACH(kv, &trk->governors, opal_value_t) {
if (0 == strcmp(kv->data.string, governor)) {
allowed = true;
break;
}
}
if (!allowed) {
vals = NULL;
OPAL_LIST_FOREACH(kv, &trk->governors, opal_value_t) {
opal_argv_append_nosize(&vals, kv->data.string);
}
tmp = opal_argv_join(vals, ',');
opal_argv_free(vals);
orte_show_help("help-rtc-freq.txt", "unsupported-governor", true,
orte_process_info.nodename, governor, tmp);
free(tmp);
/* generate an error so the errmgr can resolve it */
return;
}
/* attempt to set the value */
filename = opal_os_path(false, trk->directory, "scaling_governor", NULL);
if (NULL == (fp = fopen(filename, "w"))) {
/* not allowed - report the error */
orte_show_help("help-rtc-freq.txt", "permission-denied", true,
"governor", orte_process_info.nodename, filename);
free(filename);
return;
}
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Setting governor %s for job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), governor,
ORTE_JOBID_PRINT(jdata->jobid));
fprintf(fp, "%s\n", governor);
fclose(fp);
free(filename);
}
}
/* see if the job has the min freq attribute set */
fptr = &minfreq;
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_MIN_FREQ, (void**)&fptr, OPAL_FLOAT)) {
minfreq = -1.0;
}
/* see if the job has the max freq attribute set */
fptr = &freq;
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_MAX_FREQ, (void**)&fptr, OPAL_FLOAT)) {
/* loop thru all the cpus on this node */
OPAL_LIST_FOREACH(trk, &tracking, rtefreq_tracker_t) {
/* does the requested value match the current setting? */
if (trk->current_max_freq == freq) {
continue;
}
/* is the specified frequency among those allowed? */
allowed = false;
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
if (kv->data.fval == freq) {
allowed = true;
break;
}
}
if (!allowed) {
vals = NULL;
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
asprintf(&tmp, "%f", kv->data.fval);
opal_argv_append_nosize(&vals, tmp);
free(tmp);
}
tmp = opal_argv_join(vals, ',');
opal_argv_free(vals);
orte_show_help("help-rtc-freq.txt", "unsupported-freq", true, freq, tmp);
free(tmp);
/* generate an error so the errmgr can resolve it */
return;
}
/* if we got a min freq and the two are the same, then use setspeed if supported */
if (minfreq == freq && trk->setspeed) {
filename = opal_os_path(false, trk->directory, "scaling_setspeed", NULL);
setspeed_used = true;
} else {
filename = opal_os_path(false, trk->directory, "scaling_max_freq", NULL);
}
/* attempt to set the value */
if (NULL == (fp = fopen(filename, "w"))) {
/* not allowed - report the error */
orte_show_help("help-rtc-freq.txt", "permission-denied", true,
"max freq", orte_process_info.nodename, filename);
free(filename);
return;
}
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Setting %s freq controls to %ld for job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
setspeed_used ? "cpu" : "max",
(unsigned long)(freq * 1000000.0),
ORTE_JOBID_PRINT(jdata->jobid));
fprintf(fp, "%ld\n", (unsigned long)(freq * 1000000.0));
fclose(fp);
free(filename);
}
}
if (!setspeed_used && 0.0 < minfreq) {
/* need to process the min freq value - loop thru all the cpus on this node */
OPAL_LIST_FOREACH(trk, &tracking, rtefreq_tracker_t) {
/* does the requested value match the current setting? */
if (trk->current_min_freq == minfreq) {
continue;
}
/* is the specified frequency among those allowed? */
allowed = false;
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
if (kv->data.fval == minfreq) {
allowed = true;
break;
}
}
if (!allowed) {
vals = NULL;
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
asprintf(&tmp, "%f", kv->data.fval);
opal_argv_append_nosize(&vals, tmp);
free(tmp);
}
tmp = opal_argv_join(vals, ',');
opal_argv_free(vals);
orte_show_help("help-rtc-freq.txt", "unsupported-freq", true, minfreq, tmp);
free(tmp);
/* generate an error so the errmgr can resolve it */
return;
}
filename = opal_os_path(false, trk->directory, "scaling_min_freq", NULL);
/* attempt to set the value */
if (NULL == (fp = fopen(filename, "w"))) {
/* not allowed - report the error */
orte_show_help("help-rtc-freq.txt", "permission-denied", true,
"min freq", orte_process_info.nodename, filename);
free(filename);
return;
}
opal_output_verbose(2, orte_rtc_base_framework.framework_output,
"%s Setting min freq controls to %ld for job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(unsigned long)(minfreq * 1000000.0),
ORTE_JOBID_PRINT(jdata->jobid));
fprintf(fp, "%ld\n", (unsigned long)(minfreq * 1000000.0));
fclose(fp);
free(filename);
}
}
}
static void getvals(opal_list_t *vals)
{
rtefreq_tracker_t *trk;
orte_rtc_resource_t *res;
opal_value_t *kv;
char *tmp, **args;
res = OBJ_NEW(orte_rtc_resource_t);
OPAL_LIST_FOREACH(trk, &tracking, rtefreq_tracker_t) {
res = OBJ_NEW(orte_rtc_resource_t);
res->component = strdup(mca_rtc_freq_component.super.base_version.mca_component_name);
asprintf(&res->category, "core-%d", trk->core);
opal_list_append(vals, &res->super);
args = NULL;
OPAL_LIST_FOREACH(kv, &trk->governors, opal_value_t) {
opal_argv_append_nosize(&args, kv->data.string);
}
res->control.key = strdup("governors");
res->control.type = OPAL_STRING;
res->control.data.string = opal_argv_join(args, ',');
opal_argv_free(args);
res = OBJ_NEW(orte_rtc_resource_t);
res->component = strdup(mca_rtc_freq_component.super.base_version.mca_component_name);
asprintf(&res->category, "core-%d", trk->core);
opal_list_append(vals, &res->super);
args = NULL;
OPAL_LIST_FOREACH(kv, &trk->frequencies, opal_value_t) {
asprintf(&tmp, "%f", kv->data.fval);
opal_argv_append_nosize(&args, tmp);
free(tmp);
}
res->control.key = strdup("frequencies");
res->control.type = OPAL_STRING;
res->control.data.string = opal_argv_join(args, ',');
opal_argv_free(args);
}
}

Просмотреть файл

@ -1,34 +0,0 @@
/*
* Copyright (c) 2014 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*/
#ifndef ORTE_RTC_FREQ_H
#define ORTE_RTC_FREQ_H
#include "orte_config.h"
#include "orte/mca/rtc/rtc.h"
BEGIN_C_DECLS
typedef struct {
orte_rtc_base_component_t super;
char *governor;
char *max_freq;
char *min_freq;
} orte_rtc_freq_component_t;
ORTE_MODULE_DECLSPEC extern orte_rtc_freq_component_t mca_rtc_freq_component;
extern orte_rtc_base_module_t orte_rtc_freq_module;
END_C_DECLS
#endif /* ORTE_RTC_FREQ_H */

Просмотреть файл

@ -1,122 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/base/base.h"
#include "orte/util/show_help.h"
#include "rtc_freq.h"
/*
* Local functions
*/
static int rtc_freq_query(mca_base_module_t **module, int *priority);
static int rtc_freq_register(void);
static int my_priority;
orte_rtc_freq_component_t mca_rtc_freq_component = {
{
.base_version = {
ORTE_RTC_BASE_VERSION_1_0_0,
.mca_component_name = "freq",
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION),
.mca_query_component = rtc_freq_query,
.mca_register_component_params = rtc_freq_register,
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
}
};
static char *freq;
static int rtc_freq_register(void)
{
mca_base_component_t *c = &mca_rtc_freq_component.super.base_version;
/* ordering here doesn't really matter */
my_priority = 50;
(void) mca_base_component_var_register (c, "priority", "Priority of the FREQ rtc component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&my_priority);
mca_rtc_freq_component.governor = NULL;
(void) mca_base_component_var_register (c, "governor", "Governor to be used by default (default: system setting)",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_rtc_freq_component.governor);
mca_rtc_freq_component.max_freq = NULL;
(void) mca_base_component_var_register (c, "max", "Max frequency to be used by default (default: system setting)",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_rtc_freq_component.max_freq);
mca_rtc_freq_component.min_freq = NULL;
(void) mca_base_component_var_register (c, "min", "Min frequency to be used by default (default: system setting)",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&mca_rtc_freq_component.min_freq);
freq = NULL;
(void) mca_base_component_var_register (c, NULL, "Specific frequency to be used by default",
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&freq);
if (NULL != freq) {
/* if a max/min was also given, then that is an error */
if (NULL != mca_rtc_freq_component.max_freq ||
NULL != mca_rtc_freq_component.min_freq) {
orte_show_help("help-rtc-freq.txt", "conflict-freq", true, freq,
(NULL == mca_rtc_freq_component.max_freq) ? "NULL" : mca_rtc_freq_component.max_freq,
(NULL == mca_rtc_freq_component.min_freq) ? "NULL" : mca_rtc_freq_component.min_freq);
return ORTE_ERR_SILENT;
}
/* set the max/min to the given value */
mca_rtc_freq_component.max_freq = strdup(freq);
mca_rtc_freq_component.min_freq = strdup(freq);
}
return ORTE_SUCCESS;
}
static int rtc_freq_query(mca_base_module_t **module, int *priority)
{
/* in general, only root can change the frequency setting
* of a node. However, if the sys admin has configured the
* remote node with the "userspace" governor, then individual
* users will be able to do so. Hence, we allow this component
* to always be selected, and will instead error out if the
* remote node cannot support the desired setting
*/
*priority = my_priority;
*module = (mca_base_module_t *)&orte_rtc_freq_module;
return ORTE_SUCCESS;
}

Просмотреть файл

@ -71,7 +71,7 @@ static int state_orted_close(void)
static int state_orted_component_query(mca_base_module_t **module, int *priority) static int state_orted_component_query(mca_base_module_t **module, int *priority)
{ {
if (ORTE_PROC_IS_DAEMON && !ORTE_PROC_IS_CM) { if (ORTE_PROC_IS_DAEMON) {
/* set our priority high as we are the default for orteds */ /* set our priority high as we are the default for orteds */
*priority = my_priority; *priority = my_priority;
*module = (mca_base_module_t *)&orte_state_orted_module; *module = (mca_base_module_t *)&orte_state_orted_module;

Просмотреть файл

@ -96,9 +96,6 @@ ORTE_DECLSPEC extern orte_process_name_t orte_name_invalid; /** instantiated in
/* define the name of my daemon */ /* define the name of my daemon */
#define ORTE_PROC_MY_DAEMON (&orte_process_info.my_daemon) #define ORTE_PROC_MY_DAEMON (&orte_process_info.my_daemon)
/* define the name of my scheduler */
#define ORTE_PROC_MY_SCHEDULER (&orte_process_info.my_scheduler)
ORTE_DECLSPEC extern bool orte_in_parallel_debugger; ORTE_DECLSPEC extern bool orte_in_parallel_debugger;
/* error manager callback function */ /* error manager callback function */

Просмотреть файл

@ -59,7 +59,6 @@ ORTE_DECLSPEC orte_proc_info_t orte_process_info = {
.my_hnp = ORTE_NAME_INVALID, .my_hnp = ORTE_NAME_INVALID,
.my_hnp_uri = NULL, .my_hnp_uri = NULL,
.my_parent = ORTE_NAME_INVALID, .my_parent = ORTE_NAME_INVALID,
.my_scheduler = ORTE_NAME_INVALID,
.hnp_pid = 0, .hnp_pid = 0,
.app_num = 0, .app_num = 0,
.num_procs = 1, .num_procs = 1,
@ -182,10 +181,10 @@ int orte_proc_info(void)
orte_strip_prefix = NULL; orte_strip_prefix = NULL;
(void) mca_base_var_register ("orte", "orte", NULL, "strip_prefix", (void) mca_base_var_register ("orte", "orte", NULL, "strip_prefix",
"Prefix(es) to match when deciding whether to strip leading characters and zeroes from " "Prefix(es) to match when deciding whether to strip leading characters and zeroes from "
"node names returned by daemons", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, "node names returned by daemons", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
&orte_strip_prefix); &orte_strip_prefix);
/* we have to strip node names here, if user directs, to ensure that /* we have to strip node names here, if user directs, to ensure that
* the names exchanged in the modex match the names found locally * the names exchanged in the modex match the names found locally

Просмотреть файл

@ -54,11 +54,8 @@ typedef uint32_t orte_proc_type_t;
#define ORTE_PROC_NON_MPI 0x0010 #define ORTE_PROC_NON_MPI 0x0010
#define ORTE_PROC_MPI 0x0020 #define ORTE_PROC_MPI 0x0020
#define ORTE_PROC_APP 0x0030 #define ORTE_PROC_APP 0x0030
#define ORTE_PROC_CM 0x0040
#define ORTE_PROC_AGGREGATOR 0x0080
#define ORTE_PROC_DVM 0x0102 // DVM + daemon #define ORTE_PROC_DVM 0x0102 // DVM + daemon
#define ORTE_PROC_IOF_ENDPT 0x1000 #define ORTE_PROC_IOF_ENDPT 0x1000
#define ORTE_PROC_SCHEDULER 0x2000
#define ORTE_PROC_MASTER_ACTUAL 0x4000 #define ORTE_PROC_MASTER_ACTUAL 0x4000
#define ORTE_PROC_MASTER (ORTE_PROC_MASTER_ACTUAL + ORTE_PROC_HNP) #define ORTE_PROC_MASTER (ORTE_PROC_MASTER_ACTUAL + ORTE_PROC_HNP)
@ -69,11 +66,8 @@ typedef uint32_t orte_proc_type_t;
#define ORTE_PROC_IS_NON_MPI (ORTE_PROC_NON_MPI & orte_process_info.proc_type) #define ORTE_PROC_IS_NON_MPI (ORTE_PROC_NON_MPI & orte_process_info.proc_type)
#define ORTE_PROC_IS_MPI (ORTE_PROC_MPI & orte_process_info.proc_type) #define ORTE_PROC_IS_MPI (ORTE_PROC_MPI & orte_process_info.proc_type)
#define ORTE_PROC_IS_APP (ORTE_PROC_APP & orte_process_info.proc_type) #define ORTE_PROC_IS_APP (ORTE_PROC_APP & orte_process_info.proc_type)
#define ORTE_PROC_IS_CM (ORTE_PROC_CM & orte_process_info.proc_type)
#define ORTE_PROC_IS_AGGREGATOR (ORTE_PROC_AGGREGATOR & orte_process_info.proc_type)
#define ORTE_PROC_IS_DVM (ORTE_PROC_DVM & orte_process_info.proc_type) #define ORTE_PROC_IS_DVM (ORTE_PROC_DVM & orte_process_info.proc_type)
#define ORTE_PROC_IS_IOF_ENDPT (ORTE_PROC_IOF_ENDPT & orte_process_info.proc_type) #define ORTE_PROC_IS_IOF_ENDPT (ORTE_PROC_IOF_ENDPT & orte_process_info.proc_type)
#define ORTE_PROC_IS_SCHEDULER (ORTE_PROC_SCHEDULER & orte_process_info.proc_type)
#define ORTE_PROC_IS_MASTER (ORTE_PROC_MASTER_ACTUAL & orte_process_info.proc_type) #define ORTE_PROC_IS_MASTER (ORTE_PROC_MASTER_ACTUAL & orte_process_info.proc_type)
@ -94,7 +88,6 @@ struct orte_proc_info_t {
orte_process_name_t my_hnp; /**< Name of my hnp */ orte_process_name_t my_hnp; /**< Name of my hnp */
char *my_hnp_uri; /**< Contact info for my hnp */ char *my_hnp_uri; /**< Contact info for my hnp */
orte_process_name_t my_parent; /**< Name of my parent (or my HNP if no parent was specified) */ orte_process_name_t my_parent; /**< Name of my parent (or my HNP if no parent was specified) */
orte_process_name_t my_scheduler; /**< name of the scheduler for this system */
pid_t hnp_pid; /**< hnp pid - used if singleton */ pid_t hnp_pid; /**< hnp pid - used if singleton */
orte_app_idx_t app_num; /**< our index into the app_context array */ orte_app_idx_t app_num; /**< our index into the app_context array */
orte_vpid_t num_procs; /**< number of processes in this job */ orte_vpid_t num_procs; /**< number of processes in this job */