diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index ba9a6e00a0b392934ad84c7351cc1b85b4e4200a..d1b536d0c40ca9cc4e118b23bfcf171a4545eb3d 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -630,14 +630,14 @@ void GetOptions(int argc, char *argv[]) else Msg::Fatal("Missing file name"); } - else if(!strcmp(argv[i] + 1, "nw")) { + else if(!strcmp(argv[i] + 1, "windows")) { i++; if(argv[i]) CTX::instance()->numWindows = atoi(argv[i++]); else Msg::Fatal("Missing number"); } - else if(!strcmp(argv[i] + 1, "nt")) { + else if(!strcmp(argv[i] + 1, "tiles")) { i++; if(argv[i]) CTX::instance()->numTiles = atoi(argv[i++]); @@ -996,6 +996,13 @@ void GetOptions(int argc, char *argv[]) else Msg::Fatal("Missing number"); } + else if(!strcmp(argv[i] + 1, "nt")) { + i++; + if(argv[i]) + Msg::SetNumThreads(atoi(argv[i++])); + else + Msg::Fatal("Missing number"); + } #if defined(HAVE_FLTK) else if(!strcmp(argv[i] + 1, "term")) { terminal = 1; diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index b5822d95e7c1bc05397c53e0c8fbac6abb8b28f5..35d422fba377f09514fe0ac6ee1c4e2bd0a952d8 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -1548,12 +1548,14 @@ void Msg::Barrier() #include <omp.h> int Msg::GetNumThreads(){ return omp_get_num_threads(); } +void Msg::SetNumThreads(int num){ printf("Setting num threads = %d", num); omp_set_num_threads(num); } int Msg::GetMaxThreads(){ return omp_get_max_threads(); } int Msg::GetThreadNum(){ return omp_get_thread_num(); } #else int Msg::GetNumThreads(){ return 1; } +void Msg::SetNumThreads(int num){ } int Msg::GetMaxThreads(){ return 1; } int Msg::GetThreadNum(){ return 0; } diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h index fa992d893a4749c40109f94f10be0de6d31b8836..b016a9311034503f15961dcc3b0b36e251c2b4ae 100644 --- a/Common/GmshMessage.h +++ b/Common/GmshMessage.h @@ -73,6 +73,7 @@ class Msg { static GmshMessage *GetCallback(); static void Barrier(); static int GetNumThreads(); + static void SetNumThreads(int num); static int GetMaxThreads(); static int GetThreadNum(); static void SetVerbosity(int val);