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

  • SEARCH
  • Home
  • 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 5838861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:30:47+00:00 2026-05-22T11:30:47+00:00

The code below is for using 4 nodes to communicate using MPI. I am

  • 0

The code below is for using 4 nodes to communicate using MPI. I am able to compile it successfully on the cluster using “mpiicpc”.

However, the output screen just gives me a warning, ‘Warning: Cant read mpd.hosts for list of hosts start only on current’ and hangs.

Could you please suggest what the warning means and also if it is the reason why my code hangs?


#include <mpi.h>
#include <fstream> 

using namespace std;

#define Cols 96 
#define Rows 96 

#define beats 1

ofstream fout("Vm0"); 
ofstream f1out("Vm1"); 
.....
..... 

double V[Cols][Rows];

int r,i,y,ibeat;

int my_rank;
int p;
int source; 
int dest;
int tag = 0;

//Allocating Memory
double *A = new double[Rows*sizeof(double)];
double *B = new double[Rows*sizeof(double)];
.....
......

void prttofile ();

// MAIN FUNCTION 

int main (int argc, char *argv[])
{
//MPI Commands
MPI_Status status;
MPI_Request send_request, recv_request;
MPI_Init (&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &p);

for (ibeat=0;ibeat<beats;ibeat++)
  {
    for (i=0; i<Cols/2; i++)
    {
        for (y=0; y<Rows/2; y++)
        {
            if (my_rank == 0)
                if (i < 48)
                    if (y<48)
                        V[i][y] = 0;

           ....
               .......
                   .....
        }
    }

    //Load the Array with the edge values
    for (r=0; r<Rows/2; y++)
    {
        if ((my_rank == 0) || (my_rank == 1))
        {
            A[r] = V[r][48];
            BB[r] = V[r][48];
        }

        .....
        .....

    }

   int test = 2;
   if ((my_rank%test) == 0)
   {
   MPI_Isend(C, Rows, MPI_DOUBLE, my_rank+1, 0, MPI_COMM_WORLD, &send_request); 
   MPI_Irecv(CC, Rows, MPI_DOUBLE, my_rank+1, MPI_ANY_TAG, MPI_COMM_WORLD, &recv_request);   
   }

   else if ((my_rank%test) == 1)
   ......
   ......  

    ibeat = ibeat+1;
    prttofile ();
   } //close ibeat

   MPI_Finalize ();

   } //close main

//Print to File Function to save output values
void prttofile ()
 {
    for (i = 0; i<Cols/2; i++)
      {
      for (y = 0; y<Rows/2; y++)
       {
        if (my_rank == 0)
            fout << V[i][y] << " " ;

        ....
            .....
       }
      }

      if (my_rank == 0)
      fout << endl;

      if ....
       ....
 }
  • 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-05-22T11:30:47+00:00Added an answer on May 22, 2026 at 11:30 am

    When you want to run on multiple nodes you have to tell mpirun which ones you want with the -machinefile switch. This machinefile is just a list of nodes, one per line. If you want to put 2 processes on one node, list it twice.

    So if your machines are named node1 and node2 and you want to use two cores from each:

    $ cat nodes
    node1
    node1
    node2
    node2
    $ mpirun -machinefile nodes -np 4 ./a.out
    

    If you’re using a batch control system like PBS or TORQUE (you use qsub to submit your job) then this node file is created for you and its location is in the $PBS_NODEFILE environment variable:

    mpirun -machinefile $PBS_NODEFILE -np 4 ./a.out
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I am using a tree structure of nodes similar to the code below,
I have the code below: using (SqlCommand command = new SqlCommand()) { command.CommandType =
I would like to implement a parallel version of the code below using threads
i am using below code to change the the font type of text view.
I am using below code to create a reminder in Google calendar (using Google
In the code below I am using a recursive CTE(Common Table Expression) in SQL
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I am using Polymorphic Models . Simple Question: My code below works without using
In past, I am using Listview and using below code can show a particular
I want to enable auto update script in flex3. i am using below code

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.