Closed ithaca-isr closed 1 year ago
conda config --env --set subdir osx-64
Why are you using osx-64
? I believe you be using osx-arm64
on Apple M1, don't change that.
The issue seems to happen when MPICH calls gethostbyname()
. This likely means some network misconfiguration on your machine.
What's the output of cat /etc/hosts
?
Perhaps you can fix your issue by running this command. If you do, make a backup copy of /etc/hosts
first.
I cannot reproduce the issue using the latest Mambaforge installer and a Python 3.11 + MPICH + mpi4py environment.
I am using the osx-64 for some packages that I will install because they do not work on arm64. I do not have experience with the hosts file. I made a backup already, but are you sure it won't interfere with any running process?
In the file it says: # Host Database
localhost is used to configure the loopback interface when the system is booting. Do not change this entry.
There are three addresses, one for localhost, another one for broadcast host and another one for localhost.
If you are not sure about the consequences of changing /etc/hosts
, then don't do it. I never touched my /etc/hosts
, it is like yours, and things work on my system.
What's the output of running the command hostname
?
ok. It gives me the name of a .tld file
OK, so this definitely looks like a problem in your network configuration.
Quick tip: Set the following environment variable in the command line:
export HYDRA_IFACE=lo0
and try running again. This should force mpiexec to use the loopback interface, that is, the 127.0.0.1 localhost
entry on your /etc/hosts
and sidestep the issue of your machine not having a permanent hostname.
If that does not work, then I believe the only option is to set the hostname of your machine.
sudo sudo scutil --set LocalHostName MyMac
sudo dscacheutil -flushcache
and then reboot your computer.
hostname
and verify it is "MyMac".echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
Run all these steps at your own risk, I'm not an expert on macOS network stack, I don't really know the consequences of these changes and how they can interact with other stuff in the macOS ecosystem. If you do not feel comfortable doing all these changes, it is time to ask MPICH developers about this issue.
thank you it worked! Luckily, I did not need to do Step 3.
Solution to issue cannot be found in the documentation.
Issue
I am having difficulty running mpi codes written in osx-64 architecture on my M1 Mac. I configured my Conda environment using the command below, but it made no difference: conda config --env --set subdir osx-64
Here is the simple test code I tried to run: comm.py which I pasted below:
from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() print('My rank is ',rank)
and to run it I typed: mpiexec -np 2 python comm.py
I get the following errors: Fatal error in internal_Init_thread: Other MPI error, error stack: internal_Init_thread(60)...........: MPI_Init_thread(argc=0x0, argv=0x0, required=3, provided=0x30b632f00) failed MPII_Init_thread(209)..............: MPID_Init(75)......................: init_world(190)....................: channel initialization failed MPIDI_CH3_Init(84).................: MPID_nem_init(313).................: MPID_nem_tcp_init(175).............: MPID_nem_tcp_get_business_card(397): GetSockInterfaceAddr(370)..........: gethostbyname failed, C164CWQTWK.tld (errno 0) Fatal error in internal_Init_thread: Other MPI error, error stack: internal_Init_thread(60)...........: MPI_Init_thread(argc=0x0, argv=0x0, required=3, provided=0x30698ef00) failed MPII_Init_thread(209)..............: MPID_Init(75)......................: init_world(190)....................: channel initialization failed MPIDI_CH3_Init(84).................: MPID_nem_init(313).................: MPID_nem_tcp_init(175).............: MPID_nem_tcp_get_business_card(397): GetSockInterfaceAddr(370)..........: gethostbyname failed, C164CWQTWK.tld (errno 0)
Installed packages
Environment info