I (finally) installed GMT via homebrew on my laptop as well. As I currently experiment quite a bit with grid manipulation and plotting I was wondering why only one core seems to be utilized when running grdcontour, grdimage etc. In my understanding those should be able to run multi-threaded?
I wasn’t very successful in searching the documentation – the only place where I found something of interest was the -x option: “By default we try to use all available cores.” Which means either I didn’t understand it properly and grdcontour, grdimage etc. can’t run multi-threaded or my homebrew installation didn’t come with OpenMP support.
GMT reports as:
GMT - The Generic Mapping Tools, Version 6.0.0 [64-bit] [12 cores]
So the 12 cores got recognized but I run on only one core which is a bit sad knowing that 11 cores are hungrily waiting to convert energy into heat and nice plots while one core is screaming away doing all the work.
Any advice on how to get OpenMP support on a MacOS homebrew installation?
There are two questions in your message. I think there are news on using OMP in Macs/LLVM but I’ll leave that to Paul/Dongdong.
The other question is why are your other 11 cores sleeping. Well, generically, multi-threading is a very complicated thing. We have some parts that were parallelized but parallelization is highly dependent on the algorithm being used. Some algorithms simply cannot be parallelized. Others can but require time and knowledge. I have several times tried to parallelize programs that ended up using all cores … and take 2 to 3 times more to run.
thank you for your answer. Concerning the second part of your post:
That’s why I’m not completely sure if I should see multi-threading in action in grid manipulation. I was unable to find a list or similar of GMT programs making use of parallelization. I understand that parallelization is a very tricky beast. I’m not trained in this area, my knowledge is very limited there. I got OpenMP to run on a Linux box but I’m new to homebrew on MacOS. Lets see what Paul or Dongdong may have to add.
Please see this issue for discussion. I think we’re having troubles with supporting OpenMP on macOS, simply because MSVC and AppleClang have different flavors for openmp statements.
Ok @seisman, I was not precise enough – no OpenMP on MacOS via homebrew for me.
When I find some time I’ll go down the rabbit hole compiling GMT on MacOS from source. I feel more at home on some kind of Debian flavor … thank you for your help!
We have none, but you can have an idea on the programs that use it by running this in GMT’s src dir grep -r _OPENMP *.c
You’ll see that an attempt was made to use it in grdimage but some deep shit happened and we backed up.