-
-
Save wkrea/56f269011061d47f89b9a5be2470f4f5 to your computer and use it in GitHub Desktop.
Hello world in OpenMP. Minimal example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <omp.h> | |
#define PARENT_TID 0 | |
int main() { | |
int tid; | |
#pragma omp parallel | |
{ | |
tid = omp_get_thread_num(); | |
if(tid == PARENT_TID) | |
printf("Parent: %d threads running\n", omp_get_num_threads()); | |
else | |
printf("Thread# %d: Hello world\n", tid); | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment