summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-08 23:05:45 +0800
committerruki <[email protected]>2020-10-08 23:05:45 +0800
commit55209d22fedd5a0ea5323e81356cfe0c88603f30 (patch)
treef5e72e0081ae3fee4051adbb48b83df9c2da9e1d
parent06653a3f3b55c283b450364e930b285b27c6f364 (diff)
add openmp example
-rw-r--r--tests/projects/openmp/hello/src/main.c11
-rw-r--r--tests/projects/openmp/hello/xmake.lua3
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/projects/openmp/hello/src/main.c b/tests/projects/openmp/hello/src/main.c
new file mode 100644
index 000000000..cea215566
--- /dev/null
+++ b/tests/projects/openmp/hello/src/main.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <omp.h>
+
+int main(int argc, char** argv)
+{
+ #pragma omp parallel
+ {
+ printf("hello %d\n", omp_get_thread_num());
+ }
+ return 0;
+}
diff --git a/tests/projects/openmp/hello/xmake.lua b/tests/projects/openmp/hello/xmake.lua
new file mode 100644
index 000000000..685a6a34b
--- /dev/null
+++ b/tests/projects/openmp/hello/xmake.lua
@@ -0,0 +1,3 @@
+target("hello")
+ set_kind("binary")
+ add_files("src/*.c")