Skip to content

Commit 603250e

Browse files
committed
make hwloc_topology_load in umf constructor optional
1 parent f3dfe30 commit 603250e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/libumf.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,20 @@ umf_result_t umfInit(void) {
7777
#if !defined(UMF_NO_HWLOC)
7878
// some benchmarks uses multiple forks, and topology initialization is very slow
7979
// so if we initialize topology before the first fork, we can get significant performance gain.
80-
umfGetTopologyReduced();
80+
81+
const char *env = getenv("UMF_CONF");
82+
// todo: decide if we enable or disable umfGetTopologyReduced with env variable
83+
// todo: find better name for this string "umf.hwloc.init"
84+
// todo: with merge to master replace this with CTL
85+
#if 1
86+
if (env && strcmp(env, "umf.hwloc.init=y") == 0) {
87+
umfGetTopologyReduced();
88+
}
89+
#else
90+
if (!env || strcmp(env, "umf.hwloc.init=n") != 0) {
91+
umfGetTopologyReduced();
92+
}
93+
#endif
8194
#endif
8295
return UMF_RESULT_SUCCESS;
8396
}

0 commit comments

Comments
 (0)