[mpiwg-tools] MPI_T question about cvar value guarantees

Jeff Squyres (jsquyres) jsquyres at cisco.com
Thu Feb 4 12:27:41 CST 2016


Nathan Hjelm and I stumbled across a question regarding MPI_T today: what guarantees does MPI_T provide about control variable values when MPI_T is finalized and MPI is either not initialized or is finalized?

For example:

```C
// Block A
MPI_T_Init(...);
MPI_T_Cvar_read(..., &value_pre);
MPI_T_Cvar_write(...);
MPI_T_Finalize(...);

// ...dead zone where neither MPI_T nor MPI are initialized...

// Block B
MPI_Init(...)
MPI_T_Init(...);
MPI_T_Cvar_read(..., &value_post);
assert(value_pre == value_post);
```

Is it guaranteed that the assert() in block B must be true?

Here's why I ask -- consider the following two scenarios:

SCENARIO 1:
===========

- Block A causes a dynamically-loaded component to be loaded and initialized
- The cvar from that dynamically-loaded component is set to a default value
- The cvar is then read into value_pre
- The cvar is then assigned a non-default value
- MPI_T is then finalized
- Since MPI is not initialized, the dynamically-loaded component is unloaded (so that the process can be valgrind clean if it exits)

- Block B causes the same dynamically-loaded component to be loaded and initialized
- The cvar from that dynamically-loaded component is set to a default value
- The cvar is then read into value_post
- value_pre and value_post are both the same (default) value -- the assert passes

SCENARIO 2:
===========
- Block A causes a statically-loaded component to be initialized
- The cvar from that statically-loaded component is set to a default value
- The cvar is then read into value_pre
- The cvar is then assigned a non-default value
- MPI_T is then finalized
- Since the component is static, it is *not* unloaded

- Block B causes nothing to happen to the component (because it's statically loaded)
- The cvar from that statically-loaded component ***is still set to the non-default value***
- The cvar is then read into value_post
- value_pre and value_post are different values -- the assert fails

-- 
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/




More information about the mpiwg-tools mailing list