Loading, please wait...
🚀 Now Available on Google Play

VTU Circle

Your complete VTU student companion. Check VTU results, track SGPA & CGPA, access study resources, stay updated with VTU notifications, and connect with classmates—all in one simple and fast app.

📊 VTU Results 🎯 SGPA & CGPA 📄 Result PDF 📈 Analytics 📚 Notes 📖 Syllabus 📝 Question Papers 🛠 Study Tools 🔔 VTU Updates 🏆 Rankings 👥 Classmates 💬 Chat
Download on Google Play

BCS702 Program 7

COMMAND:

  • Create: gedit prg7.c
  • Compile: mpicc prg7.c -o prg7
  • Run: mpirun -np 4 ./prg7

PROGRAM:

#include <mpi.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    int rank, size;
    int number;

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    if (rank == 0) {
        number = 50;
        printf("Process %d broadcasting number %d to all other processes.\n", rank, number);
    }

    MPI_Bcast(&number, 1, MPI_INT, 0, MPI_COMM_WORLD);
    printf("Process %d received number %d\n", rank, number);

    MPI_Finalize();
    return 0;
}

OUTPUT:

Program7 ubuntu output
guest
0 Comments
0
Would love your thoughts, please comment.x
()
x
Syllabus Papers
SGPA CGPA