Revision: fd414771e8d0
Branch: default
Author: Brian Kocoloski <
bko...@sandia.gov>
Date: Mon Jul 8 15:19:38 2013
Log: Allow pct to work off node. Also requires that PMI_RANK and
PMI_SIZE be appropriately set as environment variables for the pct
http://code.google.com/p/kitten/source/detail?r=fd414771e8d0
Modified:
/user/runtime2/pct/pct.c
=======================================
--- /user/runtime2/pct/pct.c Wed Jul 3 07:10:27 2013
+++ /user/runtime2/pct/pct.c Mon Jul 8 15:19:38 2013
@@ -227,9 +227,10 @@
)
{
app_t *app = &pct->app;
- int i, cpu, offset, src, dst;
+ int i, cpu, offset, src, dst, global_rank, global_size, rank, size;
char env[1024];
char name[32];
+ char * env_ptr;
app->world_size = world_size;
app->universe_size = universe_size;
@@ -254,6 +255,9 @@
++i;
}
+
+ global_rank = ((env_ptr = getenv("PMI_RANK")) != NULL) ? atoi(env_ptr) :
-1;
+ global_size = ((env_ptr = getenv("PMI_SIZE")) != NULL) ? atoi(env_ptr) :
-1;
// Portals early initialization.
// Must be done before a process's address space is created.
@@ -273,9 +277,12 @@
// Setup the process's environment.
// This includes info needed to contact PPE.
+ rank = (global_rank > -1) ? global_rank : i;
+ size = (global_size > -1) ? global_size : i;
+
offset = 0;
- offset += sprintf(env + offset, "PMI_RANK=%d, ", i);
- offset += sprintf(env + offset, "PMI_SIZE=%d, ", local_size);
+ offset += sprintf(env + offset, "PMI_RANK=%d, ", rank);
+ offset += sprintf(env + offset, "PMI_SIZE=%d, ", size);
offset += sprintf(env + offset, "%s", app->procs[i].ppe_info);
sprintf(name, "RANK-%d", i);