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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:59:20+00:00 2026-05-27T14:59:20+00:00

I have recently started trying to learn MPI to code in C. I am

  • 0

I have recently started trying to learn MPI to code in C. I am trying to write very small test codes to make sure I know what I’m doing as I go along. Unfortunately, I seem to be having an issue with one of them, which multiplies a matrix with a vector and outputs the resulting vector. Specifically, when I call:

MPI_Reduce(c, myc, 3, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);

where myc is the part of the vector that is calculated by each processor, my final result is that c[i] = 0 for all i. The code that calculates myc is correct (checked using one processor and outputting myc instead of c). I assume I’m doing something very stupid here, but can’t figure out what.

  • 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-27T14:59:21+00:00Added an answer on May 27, 2026 at 2:59 pm

    So you want your answer in c and not myc?

    The syntax is:

    int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, 
               MPI_Op op, int root, MPI_Comm comm)
    

    so you are sending c into myc with your example.

    Also note that recvbuf is only valid on the root node, which in your case is node 0. All the others will have garbage in recvbuf.

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

Sidebar

Related Questions

I have several projects with a very large over-lapping code-base. We've just recently started
I have recently started working on a very large C++ project that, after completing
I have recently started using DocCheck for checking the validity of JavaDoc's in code
I just started programming with objects recently and am trying to learn good habits
I have recently started on MongodDb and I'm trying to explore on replica sets
I have recently started to use Kohana and I know inheritance is in infancy
I have recently started following the examples from The Little Schemer and when trying
I have recently started learning wpf and am trying to use mvvm. My understanding
I have recently started playing with databases, trying to teach myself using examples. I
I have recently started to play with RaphaelJS. I'm trying to find the best

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.