Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9249401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:10:46+00:00 2026-06-18T10:10:46+00:00

This question is related to this question: MPI and D: Linker Options I am

  • 0

This question is related to this question: MPI and D: Linker Options

I am trying to get MPI working from D. There are several posts to be found in the net, but none I found did actually work… So here is what I did so far:

I took the mpi.d from here https://github.com/1100110/OpenMPI/blob/master/mpi.d and set up a minimal program:

import mpi;
import std.stdio;

void* MPI_COMM_WORLD = cast(void*)0;

int main(string[] args)
{

  int rank, size;
  int argc = cast(int)args.length;
  char *** argv = cast(char***)&args;


  MPI_Init (&argc, argv);   /* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);    /* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);    /* get number of processes */
  writefln( "Hello world from process %d of %d", rank, size );
  MPI_Finalize();

  return 0;
}

I compile with

dmd test_mpi.d -L-L/usr/lib/openmpi -L-lmpi -L-ldl -L-lhwloc

or

gdc test_mpi.d -pthread -L/usr/lib/openmpi -lmpi -ldl -lhwloc -o test_mpi

and run with

mpirun -n 2 ./test_mpi

This is the error I get:

[box:1871] *** An error occurred in MPI_Comm_rank
[box:1871] *** on communicator MPI_COMM_WORLD
[box:1871] *** MPI_ERR_COMM: invalid communicator
[box:1871] *** MPI_ERRORS_ARE_FATAL: your MPI job will now abort
--------------------------------------------------------------------------
mpirun has exited due to process rank 0 with PID 1870 on
node bermuda-iii exiting improperly. There are two reasons this could occur:

1. this process did not call "init" before exiting, but others in
the job did. This can cause a job to hang indefinitely while it waits
for all processes to call "init". By rule, if one process calls "init",
then ALL processes must call "init" prior to termination.

2. this process called "init", but exited without calling "finalize".
By rule, all processes that call "init" MUST call "finalize" prior to
exiting or it will be considered an "abnormal termination"

This may have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[box:01869] 1 more process has sent help message help-mpi-errors.txt / mpi_errors_are_fatal
[box:01869] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

Obviously I do call MPI_Init and MPI_Finalize. So what am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:10:47+00:00Added an answer on June 18, 2026 at 10:10 am

    In Open MPI C communicator handles are pointers to the real communicator structures. MPI_COMM_WORLD is a pointer to the precreated world communicator structure and not a NULL pointer as you define it. That’s why Open MPI aborts in the call to MPI_COMM_RANK – it is equivalent to calling MPI_Comm_rank(NULL, &rank) in C.

    If you take a look at line 808 of mpi.d, you would notice that MPI_COMM_WORLD is already defined as:

    MPI_COMM_WORLD      = cast(void*) &(ompi_mpi_comm_world),
    

    So your code should work if you remove the line where you redefine MPI_COMM_WORLD.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to another question I wrote: Trouble using DOTNET from PHP.
This question is related to the one I asked here . I'm trying to
This question is related to calling scala code from java code. When I include
this question is related to c++ there is a library which declares a class
This question is related to this one where I found a strange workaround for
This question is related to BuddyPress, and a follow-up question from this question I
This question is related to 873448 . From Wikipedia : The Blue Brain Project
This question is Related to List returned from shutdownNow() can not be converted to
This question is related to this Say if I get the below ajax code,
This question is related to: CS5 FLASH + AS3 Hello, I am simply trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.