diff options
| author | ruki <[email protected]> | 2020-10-12 23:06:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-12 23:06:15 +0800 |
| commit | d7c0299b40a37fcf32c3f3a0a71ec60c60e4bd07 (patch) | |
| tree | f584b11de449c19cb8fe0222814ef9297c4ad0f5 /tests/projects | |
| parent | c79cdeab5474507647f1c29b2cb759550f98e8b6 (diff) | |
add loop tests for openmp
Diffstat (limited to 'tests/projects')
| -rw-r--r-- | tests/projects/openmp/loop/src/main.cpp | 12 | ||||
| -rw-r--r-- | tests/projects/openmp/loop/xmake.lua | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/projects/openmp/loop/src/main.cpp b/tests/projects/openmp/loop/src/main.cpp new file mode 100644 index 000000000..273a8538e --- /dev/null +++ b/tests/projects/openmp/loop/src/main.cpp @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <omp.h> + +int main(int argc, char** argv) +{ + #pragma omp parallel for + for (int i = 0; i < 10; ++i) + { + printf("hello(%d): i = %d\n", omp_get_thread_num(), i); + } + return 0; +} diff --git a/tests/projects/openmp/loop/xmake.lua b/tests/projects/openmp/loop/xmake.lua new file mode 100644 index 000000000..eb14be1a3 --- /dev/null +++ b/tests/projects/openmp/loop/xmake.lua @@ -0,0 +1,6 @@ +add_requires("libomp", {optional = true}) +target("loop") + set_kind("binary") + add_files("src/*.cpp") + add_rules("c++.openmp") + add_packages("libomp") |
