-#include "src/simix/private.h"
-#include "simix/context.h"
-#include "gras_config.h"
+#include "smx_private.h"
+#include "simgrid/sg_config.h"
+#include "internal_config.h"
char* smx_context_factory_name = NULL; /* factory name specified by --cfg=contexts/factory:value */
smx_ctx_factory_initializer_t smx_factory_initializer_to_use = NULL;
int smx_context_stack_size = 128 * 1024;
char* smx_context_factory_name = NULL; /* factory name specified by --cfg=contexts/factory:value */
smx_ctx_factory_initializer_t smx_factory_initializer_to_use = NULL;
int smx_context_stack_size = 128 * 1024;
static smx_context_t smx_current_context_serial;
static int smx_parallel_contexts = 1;
static int smx_parallel_threshold = 2;
static smx_context_t smx_current_context_serial;
static int smx_parallel_contexts = 1;
static int smx_parallel_threshold = 2;
- #ifdef HAVE_RAWCTX
- SIMIX_ctx_raw_factory_init(&simix_global->context_factory);
- #elif CONTEXT_UCONTEXT
- SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);
- #else
- SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
- #endif
+ #ifdef HAVE_RAWCTX
+ SIMIX_ctx_raw_factory_init(&simix_global->context_factory);
+ #elif CONTEXT_UCONTEXT
+ SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);
+ #else
+ SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
+ #endif
SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
}
else if (!strcmp(smx_context_factory_name, "raw")) {
SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
}
else if (!strcmp(smx_context_factory_name, "raw")) {
finalize_factory = simix_global->context_factory->finalize;
finalize_factory(&simix_global->context_factory);
}
finalize_factory = simix_global->context_factory->finalize;
finalize_factory(&simix_global->context_factory);
}
* If the value is greater than 1, the thread support must be enabled.
*
* \param nb_threads the number of threads to use
*/
XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) {
* If the value is greater than 1, the thread support must be enabled.
*
* \param nb_threads the number of threads to use
*/
XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) {
- xbt_assert(nb_threads > 0, "Invalid number of parallel threads: %d", nb_threads);
-
+ if (nb_threads<=0) {
+ nb_threads = xbt_os_get_numcores();
+ XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads);
+ }
+