Skip to content
Snippets Groups Projects
Commit 7bee8119 authored by Alam's avatar Alam
Browse files

git init repo

parent 00ea67a6
No related merge requests found
main
\ No newline at end of file
CC = gcc
flags = -g -Wall -o
output = main
file = omp_hello.c
opemp_directive = -fopenmp
make :
$(CC) $(flags) $(output) $(file) $(opemp_directive)
omp_hello 0 → 100755
File added
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
void Hello(void); /* Thread function */
int main(int argc, char *argv[]) {
int thread_count = strtol(argv[1], NULL, 10);
#pragma omp parallel num_threads(thread_count)
Hello();
return 0;
}
void Hello(void) {
int my_rank = omp_get_thread_num();
int thread_count = omp_get_num_threads();
printf("Hello from thread %d of %d\n", my_rank, thread_count);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment