From 675f27213be6de838cd4ef41bcbe5f8787181c80 Mon Sep 17 00:00:00 2001 From: 13511056 <13511056@hpc.if.itb.ac.id> Date: Fri, 19 Feb 2016 10:19:15 +0700 Subject: [PATCH] hello dan kerangka bucketSort --- bucketSort.c | 10 ++++++++++ omp_hello.c | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 bucketSort.c create mode 100644 omp_hello.c diff --git a/bucketSort.c b/bucketSort.c new file mode 100644 index 0000000..4517139 --- /dev/null +++ b/bucketSort.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <stdlib.h> +#include <omp.h> + +void bucketSort(); /* Thread Function */ + +int main(int argc, chra *argv[]) { + + return 0; +} diff --git a/omp_hello.c b/omp_hello.c new file mode 100644 index 0000000..06ecdea --- /dev/null +++ b/omp_hello.c @@ -0,0 +1,22 @@ +#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); +} + -- GitLab