summaryrefslogtreecommitdiffstats
path: root/Tests/FindOpenMP/Test/scalprod.f90.in
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2017-04-24 18:41:49 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-25 13:11:56 (GMT)
commit99ac0940ade3172d7b91a2215c8fb14cb8c0de1f (patch)
tree09d606e8597777c7b6f70d1d87b6ed4c531066b0 /Tests/FindOpenMP/Test/scalprod.f90.in
parentbb032c1bf583d2f26e0840b791fee07f8c7145d1 (diff)
downloadCMake-99ac0940ade3172d7b91a2215c8fb14cb8c0de1f.zip
CMake-99ac0940ade3172d7b91a2215c8fb14cb8c0de1f.tar.gz
CMake-99ac0940ade3172d7b91a2215c8fb14cb8c0de1f.tar.bz2
FindOpenMP: Add tests
Diffstat (limited to 'Tests/FindOpenMP/Test/scalprod.f90.in')
-rw-r--r--Tests/FindOpenMP/Test/scalprod.f90.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/FindOpenMP/Test/scalprod.f90.in b/Tests/FindOpenMP/Test/scalprod.f90.in
new file mode 100644
index 0000000..efc7ea0
--- /dev/null
+++ b/Tests/FindOpenMP/Test/scalprod.f90.in
@@ -0,0 +1,19 @@
+subroutine scalprod(n, x_p, y_p, res) bind(c)
+ use iso_c_binding
+ implicit none
+ integer(c_int), intent(in), value :: n
+ type(c_ptr), intent(in), value :: x_p, y_p
+ real(c_double), pointer :: x(:), y(:)
+ integer :: i
+
+ real(c_double) :: res
+ real(c_double) :: scalpt = 0
+ call c_f_pointer(x_p, x, shape=[n])
+ call c_f_pointer(y_p, y, shape=[n])
+ res = 0
+!$omp parallel do private(scalpt), reduction(+:res)
+ do i=1,n
+ scalpt = y(i) * x(i)
+ res = res + scalpt
+ end do
+end subroutine scalprod