title: Trying get Open MPI to play nicely with Fortran on OS X
body: <p>I'm trying to run a case for the software <a href="https://github.com/alphaparrot/ExoPlaSim" rel="nofollow noreferrer">ExoPlaSim</a> on my MacBook. While the software is built primarily for Linux, it can run on Mac according to the developer instructions. I'm running a simple default &quot;case&quot; script and I'm getting quite a long chain of errors. <strong>I suspect (correct me if I'm wrong) that a major reason for these errors is that Open MPI and Fortran aren't playing nicely.</strong> I lack the dev knowledge to troubleshoot this, hence my hope for some help. :)</p>
  <p>I think these following errors (end of Terminal output) are perhaps the most salient, and may indicate Fortran/Open MPI problems:</p>
  <pre><code>ld: library not found for -lm
  collect2: error: ld returned 1 exit status
  make: *** [makefile:48: plasim.x] Error 1
  ld: library not found for -lm
  collect2: error: ld returned 1 exit status
  ld: library not found for -lm
  collect2: error: ld returned 1 exit status
  cp: plasim.x: No such file or directory
  cp: ../bin/most_plasim_t21_l10_p2.x: No such file or directory
  cp: /Users/[name]/Library/Python/3.9/lib/python/site-packages/exoplasim/plasim/run/most_plasim_t21_l10_p2.x: No such file or directory
  Mean Molecular Weight set to 28.9703 g/mol
  rm: /Users/[name]/ExoPlaSim_Testing/mymodel_testrun/plasim_restart: No such file or directory
  Command '['mpiexec -np 2 most_plasim_t21_l10_p2.x']' returned non-zero exit status 134.
  Traceback (most recent call last):
    File &quot;/Users/[name]/Library/Python/3.9/lib/python/site-packages/exoplasim/__init__.py&quot;, line 796, in _run
      subprocess.run([self._exec+self.executable],shell=True,check=True,
    File &quot;/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py&quot;, line 528, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['mpiexec -np 2 most_plasim_t21_l10_p2.x']' returned non-zero exit status 134.
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/Users/[name]/ExoPlaSim_Testing/testing_exoplasim.py&quot;, line 4, in &lt;module&gt;
      mymodel.run(years=10,crashifbroken=True)
    File &quot;/Users/[name]/Library/Python/3.9/lib/python/site-packages/exoplasim/__init__.py&quot;, line 389, in run
      self._run(**kwargs)
    File &quot;/Users/[name]/Library/Python/3.9/lib/python/site-packages/exoplasim/__init__.py&quot;, line 876, in _run
      self._crash() #Bring in the cleaners
    File &quot;/Users/[name]/Library/Python/3.9/lib/python/site-packages/exoplasim/__init__.py&quot;, line 1383, in _crash
      raise RuntimeError(&quot;ExoPlaSim has crashed or begun producing garbage. All working files have been moved to %s_crashed/&quot;%(os.getcwd()+&quot;/&quot;+self.modelname))
  RuntimeError: ExoPlaSim has crashed or begun producing garbage. All working files have been moved to /Users/[name]/ExoPlaSim_Testing/mymodel_crashed/
  </code></pre>
  <p>I am using Big Sur 11.5 with compilers GNU Fortran/GCC 11.3.0. I used brew to install Open MPI, and the version I'm running (according to <code>ompi_info</code> command in terminal) is 4.1.4, which I believe should work with Fortran. Open-mpi.org does list some instructions for getting a new version of Open MPI to work on OS-X (see #7: <a href="https://www.open-mpi.org/faq/?category=osx#not-using-osx-bundled-ompi" rel="nofollow noreferrer">open-mpi.org</a>) though I don't quite understand the directions since it's outside my limited dev knowledge base. I don't know if this is the solution to my problem either.</p>
  <p>The script I'm using is the base case script for ExoPlaSim (below) It's python.</p>
  <pre><code>import exoplasim as exo
  mymodel = exo.Model(workdir=&quot;mymodel_testrun&quot;,modelname=&quot;mymodel&quot;,resolution=&quot;T21&quot;,layers=10,ncpus=8)
  mymodel.configure()
  mymodel.exportcfg()
  mymodel.run(years=100,crashifbroken=True)
  mymodel.finalize(&quot;mymodel_output&quot;)
  </code></pre>
  <p>Please note there <em>should</em> be nothing wrong with this script. It works for other users and is the script the software dev recommends using in testing. <strong>I'm looking for configuration/install solutions of the relevant libraries on my Mac.</strong> This isn't a problem with the software ExoPlaSim.</p>