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 6703289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:09:14+00:00 2026-05-26T07:09:14+00:00

Using mpi.h in C, with 4 processors, each processor has allocated a buffer (integer)

  • 0

Using mpi.h in C, with 4 processors, each processor has allocated a buffer (integer) of 8 elements, and another array (p) of 6 elements.
I initialize each p array of each processor in a way that it contains an increasing sequence of numbers (processor 0 has 0,1,2,3,4,5 ; processor 2 has 6,7,etc…).
Now I want to use MPI_Alltoallv to send each piece of the matrix in an unique array (buffer), but since the matric is 4×6, I want to send 8 elements to processor 0, 8 elements to processor 1, 4 elements to processor 2 and 4 elements to processor 3.
So i tried to do that in my code, which I link:

http://pastebin.com/EgGt6Asz

But it fails to achieve what I want to do: it just receive in buffer a 4×4 matrix, ignoring elements of index bigger than 4.

  • 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-26T07:09:14+00:00Added an answer on May 26, 2026 at 7:09 am

    According to specification of alltoallv:
    sendcounts integer array equal to the group size specifying the number of elements to send to each processor

    so you should set send buffer different for each processor
    say

    if (myid==0)
    send[]=[6,0,0,0]
    if(myid==1)
    send[]=[2,4,0,0]
    if(myid==2)
    send[]=[0,4,2,0]
    if(myid==1)
    send[]=[0,0,2,4]
    

    and displacement array accordingly.

    if (myid==0)
    disp[]=[0,0,0,0]
    if(myid==1)
    disp[]=[0,2,0,0]
    if(myid==2)
    disp[]=[0,0,4,0]
    if(myid==1)
    disp[]=[0,0,0,2]
    

    Currently you have setted each value as 1, so all processors are getting 1 value from each processor. Thus 4 values in all.

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

Sidebar

Related Questions

Using C#, I need a class called User that has a username, password, active
I'm using CentOS 5.4 x86_64 and Boost 1.42.0 on a cluster that uses Open-MPI
I have some parallel code (implemented using MPI) that needs to be documented. I'd
I am using C and MPI. How is memory allocated for arrays if the
I wish to send a contiguous array of memory between two nodes using MPI.
I'm starting work on some simulations using MPI and want to do the programming
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters

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.