Calling an external mpi executable from julia

I want to call an MPI exectable from Julia in a Jupyter notebook.

Doing

cmd = Cmd(`mpiexec -np 4 name_of_executable`)
run(cmd)

creates 4 processes, but they all use 25% cpu on one core. Is there a way to have it run 100% on four separate cores?

What are your build details (versioninfo)? It sounds like something has set the processor affinity, and I assume mpiexec knows what it’s doing. Can you try running Julia with export OPENBLAS_MAIN_FREE=1 (although our custom build of openblas should have this disabled, so it should only be a problem with system blas)?

1 Like

I am using version 0.6.0 from the Fedora repos. Setting OPENBLAS_MAIN_FREE does the trick. Thanks for the tip!

Julia Version 0.6.0
Commit 903644385b* (2017-06-19 13:05 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (DYNAMIC_ARCH Haswell)
  LAPACK: libopenblasp.so.0
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

I just checked with the 0.6.2 binaries from julialang.org and they don’t have this problem.

Julia Version 0.6.2
Commit d386e40c17 (2017-12-13 18:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Prescott)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

Great! Thanks. I think I’ve fixed this issue on master already then also.

Please post links when cross-posting issues: https://bugzilla.redhat.com/show_bug.cgi?id=1558091. This was actually a bug in recent OpenBLAS releases, which didn’t use NO_AFFINITY=1 by default. Julia isn’t actually involved AFAICT, since it specifically overrides OPENBLAS_MAIN_FREE=1 since 2015.