Просмотр исходного кода

- add a first fortran90 test case

Olivier Aumage лет назад: 10
Родитель
Сommit
5b179baa05
3 измененных файлов с 59 добавлено и 2 удалено
  1. 3 2
      include/starpu_mod.f90
  2. 26 0
      tests/Makefile.am
  3. 30 0
      tests/fortran90/init_01.f90

+ 3 - 2
include/starpu_mod.f90

@@ -26,10 +26,11 @@ MODULE starpu_mod
 
 
   ! starpu_init
   ! starpu_init
   INTERFACE
   INTERFACE
-     SUBROUTINE starpu_init(conf) BIND(C)
+     FUNCTION starpu_init(conf) BIND(C)
        USE iso_c_binding
        USE iso_c_binding
        TYPE(C_PTR), VALUE :: conf
        TYPE(C_PTR), VALUE :: conf
-     END SUBROUTINE starpu_init
+       INTEGER(KIND=C_INT) :: starpu_init
+     END FUNCTION starpu_init
   END INTERFACE
   END INTERFACE
 
 
   ! starpu_initialize
   ! starpu_initialize

+ 26 - 0
tests/Makefile.am

@@ -286,6 +286,11 @@ noinst_PROGRAMS =				\
 	sched_policies/simple_deps              \
 	sched_policies/simple_deps              \
 	sched_policies/simple_cpu_gpu_sched
 	sched_policies/simple_cpu_gpu_sched
 
 
+if STARPU_HAVE_FC
+noinst_PROGRAMS +=				\
+	fortran90/init_01
+endif
+
 if STARPU_LONG_CHECK
 if STARPU_LONG_CHECK
 noinst_PROGRAMS +=				\
 noinst_PROGRAMS +=				\
 	main/tag_task_data_deps			\
 	main/tag_task_data_deps			\
@@ -590,6 +595,12 @@ openmp_array_slice_01_SOURCES = 	\
 openmp_cuda_task_01_SOURCES = 	\
 openmp_cuda_task_01_SOURCES = 	\
 	openmp/cuda_task_01.c
 	openmp/cuda_task_01.c
 
 
+if STARPU_HAVE_FC
+fortran90_init_01_SOURCES =	\
+	$(top_srcdir)/include/starpu_mod.f90	\
+	fortran90/init_01.f90
+endif
+
 ###################
 ###################
 # Block interface #
 # Block interface #
 ###################
 ###################
@@ -804,3 +815,18 @@ sched_policies_execute_all_tasks_LDFLAGS = $(AM_LDFLAGS) -lm
 showcheck:
 showcheck:
 	-cat $(TEST_LOGS) /dev/null
 	-cat $(TEST_LOGS) /dev/null
 	! grep -q " runtime error: " $(TEST_LOGS) /dev/null
 	! grep -q " runtime error: " $(TEST_LOGS) /dev/null
+
+
+if STARPU_HAVE_FC
+# Fortran90 tests
+# - list explicit dependences to control proper module files generation
+# - the overriding rule fully disables the corresponing default rule, thus
+#   the default rule body must be copied entirely
+starpu_mod.mod: starpu_mod.o
+
+starpu_mod.o: $(top_srcdir)/include/starpu_mod.f90
+	$(AM_V_FC)$(FC) $(fortran90_init_01_FCFLAGS) $(FCFLAGS) -c -o $@ '$(top_srcdir)/'include/starpu_mod.f90
+
+init_01.o: $(top_srcdir)/tests/fortran90/init_01.f90 starpu_mod.mod
+	$(AM_V_FC)$(FC) $(fortran90_init_01_FCFLAGS) $(FCFLAGS) -c -o $@ `test -f 'fortran90/init_01.f90' || echo '$(srcdir)/'`fortran90/init_01.f90
+endif

+ 30 - 0
tests/fortran90/init_01.f90

@@ -0,0 +1,30 @@
+! StarPU --- Runtime system for heterogeneous multicore architectures.
+!
+! Copyright (C) 2015  Inria
+!
+! StarPU is free software; you can redistribute it and/or modify
+! it under the terms of the GNU Lesser General Public License as published by
+! the Free Software Foundation; either version 2.1 of the License, or (at
+! your option) any later version.
+!
+! StarPU is distributed in the hope that it will be useful, but
+! WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+!
+! See the GNU Lesser General Public License in COPYING.LGPL for more details.
+
+PROGRAM init_01
+
+  USE starpu_mod
+  USE iso_c_binding
+
+  IMPLICIT NONE
+
+  INTEGER(KIND=C_INT) :: res
+
+  res = starpu_init(C_NULL_PTR)
+  IF (res /= 0) THEN
+          STOP 77
+  END IF
+  CALL starpu_shutdown()
+END PROGRAM init_01