riscv-software-src / riscv-tools

RISC-V Tools (ISA Simulator and Tests)
1.13k stars 446 forks source link

MPI application not working in risc-v linux #275

Open billasurendra opened 5 years ago

billasurendra commented 5 years ago

I have cross compiled MPI program and generated a statically linked executable. I booted riscv-linux using spike and I tried to execute above mentioned executable. Surprisingly execution resulted in following error.

error ./rs_out Fatal error in MPI_Init: Other MPI error, error stack: MPIR_Init_thread(490)..............: MPID_Init(395).....................: channel initialization failed MPIDI_CH3_Init(104)................: MPID_nem_init(320).................: MPID_nem_tcp_init(173).............: MPID_nem_tcp_get_business_card(420): MPID_nem_tcp_init(379).............: gethostbyname failed, ucbvax (errno 2)

Kindly provide a solution.

jim-wilson commented 5 years ago

riscv-linux is just a kernel. If you want to run MPI programs then you need a complete OS, and whether this works will depend on other things like glibc. If you are cross compiling and static linking to get programs to work, then you are probably doing something wrong, e.g. using a toolchain that isn't fully compatible with the target OS. If you continue doing things this way, you are going to have a lot of trouble

This will work better if you use qemu instead of spike. Spike is for hardware testing, qemu is for software testing. Also, you need a real OS running on qemu, like Debian, Fedora, or OpenEmbedded. Then you need a real toolchain. If you are using a real OS, it will come with a real native toolchain. You can build MPI programs natively inside linux running on qemu. Or you can alternatively build a cross toolchain by extracting a sysroot from the target filesystem, and using that to build the cross toolchain. Then you should be able to cross build and natively run MPI programs.