Add a useful test and update another
This commit was SVN r29370.
Этот коммит содержится в:
родитель
587f21b18b
Коммит
2bd2284b93
@ -1,4 +1,4 @@
|
||||
PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_ring spawn_child orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix orte_barrier opal_interface orte_spin segfault orte_exit orte_db orte_sensor test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel orte_dfs orte_allocate
|
||||
PROGS = no_op sigusr_trap spin orte_nodename orte_spawn orte_loop_spawn orte_loop_child orte_abort get_limits orte_ring spawn_child orte_tool orte_no_op binom oob_stress iof_stress iof_delay radix orte_barrier opal_interface orte_spin segfault orte_exit orte_db orte_sensor test-time event-threads psm_keygen regex orte_errors evpri-test opal-evpri-test evpri-test2 mapper reducer opal_hotel orte_dfs orte_allocate pmi_abort
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
@ -8,5 +8,8 @@ CXX = ortec++
|
||||
CXXFLAGS = -g
|
||||
FFLAGS = -g
|
||||
|
||||
pmi_abort:
|
||||
gcc -I$(SLURMHOME)/include/slurm -L$(SLURMHOME)/lib -lpmi -o pmi_abort pmi_abort.c
|
||||
|
||||
clean:
|
||||
rm -f $(PROGS) *~
|
||||
|
@ -26,6 +26,8 @@ int main(int argc, char **argv, char **envp)
|
||||
int rc = EXIT_SUCCESS;
|
||||
char *err = NULL;
|
||||
PMI_BOOL pmi_initialized = PMI_FALSE;
|
||||
int pmi_vallen_max, max_length;
|
||||
char *pmi_kvs_name;
|
||||
|
||||
/* sanity */
|
||||
if (PMI_SUCCESS != PMI_Initialized(&pmi_initialized) ||
|
||||
@ -49,6 +51,24 @@ int main(int argc, char **argv, char **envp)
|
||||
err = "PMI_Get_clique_size failure!";
|
||||
goto done;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_KVS_Get_value_length_max(&pmi_vallen_max)) {
|
||||
err = "PMI_KVS_Get_value_length_max failure!";
|
||||
goto done;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_KVS_Get_name_length_max(&max_length)) {
|
||||
err = "PMI_KVS_Get_name_length_max failure!";
|
||||
goto done;
|
||||
}
|
||||
pmi_kvs_name = (char*)malloc(max_length);
|
||||
if (NULL == pmi_kvs_name) {
|
||||
err = "malloc failure!";
|
||||
goto done;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_KVS_Get_my_name(pmi_kvs_name,max_length)) {
|
||||
err = "PMI_KVS_Get_my_name failure!";
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (NULL == (local_rank_ids = calloc(num_local_procs, sizeof(int)))) {
|
||||
err = "out of resources";
|
||||
goto done;
|
||||
@ -58,11 +78,11 @@ int main(int argc, char **argv, char **envp)
|
||||
goto done;
|
||||
}
|
||||
/* lowest local rank will print env info and tag its output*/
|
||||
if (pmi_rank == local_rank_ids[0]) {
|
||||
for (; NULL != envp && NULL != *envp; ++envp) {
|
||||
printf("===[%d]: %s\n", pmi_rank, *envp);
|
||||
}
|
||||
}
|
||||
// if (pmi_rank == local_rank_ids[0]) {
|
||||
// for (; NULL != envp && NULL != *envp; ++envp) {
|
||||
// printf("===[%d]: %s\n", pmi_rank, *envp);
|
||||
// }
|
||||
//}
|
||||
|
||||
done:
|
||||
if (PMI_TRUE == pmi_initialized) {
|
||||
|
73
orte/test/system/pmi_abort.c
Обычный файл
73
orte/test/system/pmi_abort.c
Обычный файл
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Intel, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "pmi.h"
|
||||
|
||||
/* NOTES
|
||||
*
|
||||
* useful debug environment variables:
|
||||
* PMI_DEBUG
|
||||
*/
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
int pmi_rank = -1;
|
||||
int pmi_process_group_size = -1;
|
||||
int rc = EXIT_SUCCESS;
|
||||
char *err = NULL;
|
||||
PMI_BOOL pmi_initialized = PMI_FALSE;
|
||||
int i;
|
||||
double pi;
|
||||
int spawned;
|
||||
|
||||
if (1 < argc) {
|
||||
rc = strtol(argv[1], NULL, 10);
|
||||
} else {
|
||||
rc = 3;
|
||||
}
|
||||
|
||||
/* sanity */
|
||||
if (PMI_SUCCESS != PMI_Initialized(&pmi_initialized) ||
|
||||
PMI_TRUE == pmi_initialized) {
|
||||
fprintf(stderr, "=== ERROR: PMI sanity failure\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_Init(&spawned)) {
|
||||
err = "PMI_Init failure!";
|
||||
goto done;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_Get_size(&pmi_process_group_size)) {
|
||||
err = "PMI_Get_size failure!";
|
||||
goto done;
|
||||
}
|
||||
if (PMI_SUCCESS != PMI_Get_rank(&pmi_rank)) {
|
||||
err = "PMI_Get_rank failure!";
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (PMI_TRUE == pmi_initialized) {
|
||||
i = 0;
|
||||
while (1) {
|
||||
i++;
|
||||
pi = i / 3.14159256;
|
||||
if (i > 10000) i = 0;
|
||||
if ((pmi_rank == 3 ||
|
||||
(pmi_process_group_size <= 3 && pmi_rank == 0))
|
||||
&& i == 9995) {
|
||||
PMI_Abort(rc, "RANK0 CALLED ABORT");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NULL != err) {
|
||||
fprintf(stderr, "=== ERROR [rank:%d] %s\n", pmi_rank, err);
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
return rc;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user