Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101652034
hello_world_mpi_openmp.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 12, 11:35
Size
602 B
Mime Type
text/x-c
Expires
Fri, Feb 14, 11:35 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24208414
Attached To
R7871 phys-743-exercises
hello_world_mpi_openmp.c
View Options
#include <stdio.h>
#include <mpi.h>
#include <omp.h>
int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
int * provided;
char processor_name[MPI_MAX_PROCESSOR_NAME];
int iam = 0, np = 1;
MPI_Init_thread(&argc, &argv,MPI_THREAD_SINGLE,provided);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#pragma omp parallel default(shared) private(iam, np)
{
np = omp_get_num_threads();
iam = omp_get_thread_num();
printf("Hello from thread %d out of %d from process %d out of %d on\n",iam, np, rank, numprocs);
}
MPI_Finalize();
}
Event Timeline
Log In to Comment