From 3333645730c3ca708beadcc9b197de3ac43b361c Mon Sep 17 00:00:00 2001 From: gazandic <gazandic@gmail.com> Date: Fri, 19 Feb 2016 16:35:00 +0700 Subject: [PATCH] tambah hello --- hello.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 hello.c diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..ad1ae0a --- /dev/null +++ b/hello.c @@ -0,0 +1,24 @@ +#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 for ordered schedule(static) 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); +} + -- GitLab