A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove surf_file_t and smx_file_t for only m_file_t
[simgrid.git]
/
src
/
simix
/
smx_context.c
diff --git
a/src/simix/smx_context.c
b/src/simix/smx_context.c
index
9faef0e
..
39d77bd
100644
(file)
--- a/
src/simix/smx_context.c
+++ b/
src/simix/smx_context.c
@@
-10,7
+10,7
@@
#include "xbt/log.h"
#include "xbt/swag.h"
#include "xbt/xbt_os_thread.h"
#include "xbt/log.h"
#include "xbt/swag.h"
#include "xbt/xbt_os_thread.h"
-#include "s
rc/simix/
private.h"
+#include "s
mx_
private.h"
#include "simix/context.h"
#include "gras_config.h"
#include "simix/context.h"
#include "gras_config.h"
@@
-139,14
+139,17
@@
XBT_INLINE int SIMIX_context_get_nthreads(void) {
*/
XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) {
*/
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);
+ }
+
if (nb_threads > 1) {
#ifndef CONTEXT_THREADS
THROWF(arg_error, 0, "The thread factory cannot be run in parallel");
#endif
}
if (nb_threads > 1) {
#ifndef CONTEXT_THREADS
THROWF(arg_error, 0, "The thread factory cannot be run in parallel");
#endif
}
-
+
smx_parallel_contexts = nb_threads;
}
smx_parallel_contexts = nb_threads;
}