Update of unit test for name server - submitted to Jeff for review.
This commit was SVN r1628.
Этот коммит содержится в:
родитель
4c358b6435
Коммит
7e20e8f430
@ -18,6 +18,7 @@ test_ns_replica_LDADD = \
|
||||
$(top_builddir)/src/util/strncpy.lo \
|
||||
$(top_builddir)/src/mca/ns/base/libmca_ns_base.la \
|
||||
$(top_builddir)/src/mca/ns/replica/src/libmca_ns_replica.la \
|
||||
$(top_builddir)/src/mca/ns/proxy/src/libmca_ns_proxy.la \
|
||||
$(top_builddir)/src/libmpi.la \
|
||||
$(top_builddir)/src/threads/mutex.lo \
|
||||
$(top_builddir)/src/threads/mutex_pthread.lo \
|
||||
|
@ -24,13 +24,25 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ompi_process_name_t *test_name;
|
||||
ompi_process_id_t test, job, tmpi, tmpj, tmpk;
|
||||
bool multi, hidden;
|
||||
int i;
|
||||
char *tmp;
|
||||
|
||||
/* get system info */
|
||||
ompi_sys_info();
|
||||
ompi_proc_info();
|
||||
|
||||
/* set us to be seed */
|
||||
ompi_process_info.seed = true;
|
||||
ompi_proc_info();
|
||||
|
||||
/* check that proc info made seed name */
|
||||
if (NULL == ompi_process_info.name) {
|
||||
fprintf(stderr, "seed name not made\n");
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(stderr, "seed name made: %x %x %x\n", ompi_process_info.name->cellid,
|
||||
ompi_process_info.name->jobid, ompi_process_info.name->vpid);
|
||||
}
|
||||
|
||||
/* startup the MCA */
|
||||
if (OMPI_SUCCESS == mca_base_open()) {
|
||||
@ -49,7 +61,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* startup the name server */
|
||||
if (OMPI_SUCCESS != mca_ns_base_select(false, false)) {
|
||||
if (OMPI_SUCCESS != mca_ns_base_select(&multi, &hidden)) {
|
||||
fprintf(stderr, "NS could not start\n");
|
||||
exit(1);
|
||||
} else {
|
||||
@ -65,5 +77,54 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "got process name: %x %x %x\n", test_name->cellid, test_name->jobid, test_name->vpid);
|
||||
}
|
||||
|
||||
/* create a cellid */
|
||||
test = ompi_name_server.create_cellid();
|
||||
if (0 == test) { /* got error */
|
||||
fprintf(stderr, "create cellid: error %d\n", test);
|
||||
/* exit(1); */
|
||||
} else {
|
||||
fprintf(stderr, "cellid created: %d\n", test);
|
||||
}
|
||||
|
||||
for (i=0; i<10; i++) { /* loop through */
|
||||
/* create jobid */
|
||||
job = ompi_name_server.create_jobid();
|
||||
if (0 == job) { /* got error */
|
||||
fprintf(stderr, "create jobid: error\n");
|
||||
/* exit(1); */
|
||||
} else {
|
||||
fprintf(stderr, "jobid created: %d\n", job);
|
||||
}
|
||||
|
||||
/* get range of vpids */
|
||||
test = ompi_name_server.reserve_range(job, 250);
|
||||
if (0 == test) { /* got error */
|
||||
fprintf(stderr, "get range: error\n");
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(stderr, "range reserved: %d\n", test);
|
||||
}
|
||||
|
||||
/* create a name */
|
||||
test_name = ompi_name_server.create_process_name((ompi_process_id_t)i, job, test);
|
||||
|
||||
/* get and print its string values */
|
||||
tmp = ompi_name_server.get_proc_name_string(test_name);
|
||||
fprintf(stderr, "(%d) strings: name - %s\n", i, tmp);
|
||||
tmp = ompi_name_server.get_vpid_string(test_name);
|
||||
fprintf(stderr, "\tvpid: %s\n", tmp);
|
||||
tmp = ompi_name_server.get_jobid_string(test_name);
|
||||
fprintf(stderr, "\tjobid: %s\n", tmp);
|
||||
tmp = ompi_name_server.get_cellid_string(test_name);
|
||||
fprintf(stderr, "\tcellid: %s\n", tmp);
|
||||
|
||||
tmpi = ompi_name_server.get_vpid(test_name);
|
||||
tmpj = ompi_name_server.get_jobid(test_name);
|
||||
tmpk = ompi_name_server.get_cellid(test_name);
|
||||
fprintf(stderr, "(%d) ints cell %x job %x vpid %x\n\n", i, tmpk, tmpj, tmpi);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user