static void _surf_cfg_cb_contexts_nthreads(const char *name, int pos)
{
- SIMIX_context_set_nthreads(xbt_cfg_get_string(_surf_cfg_set, name));
+ unsigned int nthreads;
+ const char* value = xbt_cfg_get_string(_surf_cfg_set, name);
+ if (!strcmp(value, "auto")) {
+ XBT_DEBUG("Auto setting contexts/nthreads to %d", PROCESSOR_COUNT);
+ nthreads = PROCESSOR_COUNT;
+ }
+ else {
+ nthreads = atoi(value);
+ xbt_assert(nthreads > 0, "context/threads should be a positive number or 'auto'");
+ }
+ SIMIX_context_set_nthreads(nthreads);
}
static void _surf_cfg_cb_contexts_parallel_threshold(const char *name, int pos)