Search
 
SCRIPT & CODE EXAMPLE
 

C

mpi example

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

int main(int argc, char** argv) {
    // Initialize the MPI environment
    MPI_Init(NULL, NULL);

    // Get the number of processes
    int world_size;
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);

    // Get the rank of the process
    int world_rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

    // Get the name of the processor
    char processor_name[MPI_MAX_PROCESSOR_NAME];
    int name_len;
    MPI_Get_processor_name(processor_name, &name_len);

    // Print off a hello world message
    printf("Hello world from processor %s, rank %d out of %d processors
",
           processor_name, world_rank, world_size);

    // Finalize the MPI environment.
    MPI_Finalize();
}
Comment

PREVIOUS NEXT
Code Example
C :: The fscanf and fprintf functions 
C :: check if string is the same c 
C :: c/c++ windows api download file 
C :: c programming language 
C :: c functions example 
C :: How to convert string to int without using library functions in c 
C :: mount cifs 
C :: keep last n bits 
C :: print hello world in c 
C :: pointer to function c 
C :: Bitwise Operators in C language 
C :: delay in c programming for windows 
C :: print float number completely in C language 
C :: create node in c 
C :: sockaddr_in c 
C :: cifras de un numero en c 
C :: getchar c 
C :: stddef.h 
C :: time include c 
C :: armstrong in c 
C :: node in c 
C :: c malloc 
C :: C/AL Convertion of Decimal to String/Text 
C :: data-types 
C :: change base int in c 
C :: Combine two sentences into one langage c 
C :: libreoffice reference cell in different sheet with sheet name with space 
C :: command line arguments to copy paste in c 
C :: float para numeros aleatorios em c 
C :: fina students name by using html backend database 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =