Browse Source

- preliminary common StarPU module file for Fortran90 codes

Olivier Aumage 10 years ago
parent
commit
43ee6b0a98

+ 2 - 1
Makefile.am

@@ -89,7 +89,8 @@ versinclude_HEADERS = 				\
 	include/starpu_thread.h			\
 	include/starpu_thread_util.h		\
 	include/starpu_tree.h			\
-	include/starpu_simgrid_wrap.h
+	include/starpu_simgrid_wrap.h		\
+	include/mod_starpu.f90
 
 nodist_versinclude_HEADERS = 			\
 	include/starpu_config.h

+ 6 - 1
examples/Makefile.am

@@ -330,6 +330,7 @@ endif
 if STARPU_HAVE_FC
 fortran90_f90_example_SOURCES =	\
 	fortran90/mod_types.f90		\
+	$(top_srcdir)/include/mod_starpu.f90	\
 	fortran90/mod_interface.f90	\
 	fortran90/mod_compute.f90	\
 	fortran90/marshalling.c		\
@@ -935,8 +936,12 @@ if STARPU_HAVE_FC
 mod_types.mod: fortran90_f90_example-mod_types.o
 mod_compute.mod: fortran90_f90_example-mod_compute.o
 mod_interface.mod: fortran90_f90_example-mod_interface.o
+mod_starpu.mod: fortran90_f90_example-mod_starpu.o
 
-fortran90_f90_example-mod_compute.o: fortran90/mod_compute.f90 mod_types.mod mod_interface.mod
+fortran90_f90_example-mod_starpu.o: 
+	$(AM_V_FC)$(FC) $(fortran90_f90_example_FCFLAGS) $(FCFLAGS) -c -o fortran90_f90_example-mod_starpu.o '$(top_srcdir)/'include/mod_starpu.f90
+
+fortran90_f90_example-mod_compute.o: fortran90/mod_compute.f90 mod_types.mod mod_interface.mod mod_starpu.mod
 	$(AM_V_FC)$(FC) $(fortran90_f90_example_FCFLAGS) $(FCFLAGS) -c -o fortran90_f90_example-mod_compute.o `test -f 'fortran90/mod_compute.f90' || echo '$(srcdir)/'`fortran90/mod_compute.f90
 
 fortran90_f90_example-f90_example.o: fortran90/f90_example.f90 mod_types.mod mod_interface.mod mod_compute.mod

+ 7 - 2
examples/fortran90/Makefile

@@ -16,6 +16,8 @@
 
 PROG = f90_example
 
+STARPU_MOD = $(shell pkg-config --cflags-only-I starpu-1.3|sed -e 's/^-I//;s/  *//g')/mod_starpu.f90
+
 SRCSF = mod_types.f90		\
 	mod_interface.f90	\
 	mod_compute.f90		\
@@ -29,7 +31,7 @@ CFLAGS = -g $(shell pkg-config --cflags starpu-1.3)
 FCFLAGS = -fdefault-real-8 -J. -g
 LDLIBS =  $(shell pkg-config --libs starpu-1.3)
 
-OBJS = $(SRCSC:%.c=%.o) $(SRCSF:%.f90=%.o)
+OBJS = $(SRCSC:%.c=%.o) mod_starpu.o $(SRCSF:%.f90=%.o)
 
 .phony: all clean
 all: $(PROG)
@@ -40,6 +42,9 @@ $(PROG): $(OBJS)
 %.o: %.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
+mod_starpu.o: $(STARPU_MOD)
+	$(FC) $(FCFLAGS) -c -o $@ $<
+
 %.o: %.f90
 	$(FC) $(FCFLAGS) -c -o $@ $<
 
@@ -47,5 +52,5 @@ clean:
 	rm -fv *.o *.mod $(PROG)
 
 # modfiles generation dependences
-mod_compute.o: mod_compute.f90 mod_types.o mod_interface.o
+mod_compute.o: mod_compute.f90 mod_types.o mod_interface.o mod_starpu.o
 f90_example.o: f90_example.f90 mod_types.o mod_interface.o mod_compute.o

+ 2 - 1
examples/fortran90/f90_example.f90

@@ -17,6 +17,7 @@
 PROGRAM f90_example
 
   USE mod_types
+  USE mod_starpu
   USE mod_interface
   USE mod_compute
   USE iso_c_binding
@@ -47,7 +48,7 @@ PROGRAM f90_example
   ENDDO
 
   !Initialization of StarPU
-  res = starpu_init_c()
+  res = starpu_init_c(C_NULL_PTR)
 
   !Registration of elements
   DO i = 1,Nelt

+ 1 - 0
examples/fortran90/mod_compute.f90

@@ -17,6 +17,7 @@
 MODULE mod_compute
 
   USE mod_types
+  USE mod_starpu
   USE mod_interface
   USE iso_c_binding
 

+ 0 - 17
examples/fortran90/mod_interface.f90

@@ -51,21 +51,4 @@ MODULE mod_interface
      END SUBROUTINE starpu_copy_element_task_c
   END INTERFACE
 
-  INTERFACE
-     FUNCTION starpu_init_c() BIND(C)
-       USE iso_c_binding
-       INTEGER(KIND=C_INT)                   :: main_starpu_init_c
-     END FUNCTION starpu_init_c
-  END INTERFACE
-
-  INTERFACE starpu_task_wait_for_all_c
-     SUBROUTINE starpu_task_wait_for_all() BIND(C)
-     END SUBROUTINE starpu_task_wait_for_all
-  END INTERFACE
-
-  INTERFACE starpu_shutdown_c
-     SUBROUTINE starpu_shutdown() BIND(C)
-     END SUBROUTINE starpu_shutdown
-  END INTERFACE
-
 END MODULE mod_interface

+ 134 - 0
include/mod_starpu.f90

@@ -0,0 +1,134 @@
+! 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.
+
+MODULE mod_starpu
+        ! == starpu.h ==
+
+        ! starpu_conf_init
+        INTERFACE starpu_conf_init_c
+                FUNCTION starpu_conf_init(conf) BIND(C)
+                        USE iso_c_binding
+                        TYPE(C_PTR), INTENT(INOUT) :: conf
+                END FUNCTION starpu_conf_init
+        END INTERFACE
+
+        ! starpu_init
+        INTERFACE starpu_init_c
+                FUNCTION starpu_init(conf) BIND(C)
+                        USE iso_c_binding
+                        TYPE(C_PTR), INTENT(IN) :: conf
+                END FUNCTION starpu_init
+        END INTERFACE
+
+        ! starpu_initialize
+
+        ! starpu_pause
+        INTERFACE starpu_pause_c
+                SUBROUTINE starpu_pause() BIND(C)
+                END SUBROUTINE starpu_pause
+        END INTERFACE
+
+        ! starpu_resume
+        INTERFACE starpu_resume_c
+                SUBROUTINE starpu_resume() BIND(C)
+                END SUBROUTINE starpu_resume
+        END INTERFACE
+
+        ! starpu_shutdown
+        INTERFACE starpu_shutdown_c
+                SUBROUTINE starpu_shutdown() BIND(C)
+                END SUBROUTINE starpu_shutdown
+        END INTERFACE
+
+        ! starpu_topology_print
+
+        ! starpu_asynchronous_copy_disabled
+        INTERFACE starpu_asynchronous_copy_disabled_c
+                SUBROUTINE starpu_asynchronous_copy_disabled() BIND(C)
+                END SUBROUTINE starpu_asynchronous_copy_disabled
+        END INTERFACE
+
+        ! starpu_asynchronous_cuda_copy_disabled
+        INTERFACE starpu_asynchronous_cuda_copy_disabled_c
+                SUBROUTINE starpu_asynchronous_cuda_copy_disabled() BIND(C)
+                END SUBROUTINE starpu_asynchronous_cuda_copy_disabled
+        END INTERFACE
+
+        ! starpu_asynchronous_opencl_copy_disabled
+        INTERFACE starpu_asynchronous_opencl_copy_disabled_c
+                SUBROUTINE starpu_asynchronous_opencl_copy_disabled() BIND(C)
+                END SUBROUTINE starpu_asynchronous_opencl_copy_disabled
+        END INTERFACE
+
+        ! starpu_asynchronous_mic_copy_disabled
+        INTERFACE starpu_asynchronous_mic_copy_disabled_c
+                SUBROUTINE starpu_asynchronous_mic_copy_disabled() BIND(C)
+                END SUBROUTINE starpu_asynchronous_mic_copy_disabled
+        END INTERFACE
+
+        ! starpu_display_stats
+        INTERFACE starpu_display_stats_c
+                SUBROUTINE starpu_display_stats() BIND(C)
+                END SUBROUTINE starpu_display_stats
+        END INTERFACE
+
+        ! starpu_get_version
+        INTERFACE starpu_get_version_c
+                FUNCTION starpu_get_version(major,minor,release) BIND(C)
+                        USE iso_c_binding
+                        TYPE(C_PTR), INTENT(OUT) :: major,minor,release
+                END FUNCTION starpu_get_version
+        END INTERFACE
+
+        ! == starpu_task.h ==
+
+        ! starpu_tag_declare_deps
+        ! starpu_tag_declare_deps_array
+        ! starpu_task_declare_deps_array
+        ! starpu_tag_wait
+        ! starpu_tag_wait_array
+        ! starpu_tag_notify_from_apps
+        ! starpu_tag_restart
+        ! starpu_tag_remove
+        ! starpu_task_init
+        ! starpu_task_clean
+        ! starpu_task_create
+        ! starpu_task_destroy
+        ! starpu_task_submit
+        ! starpu_task_submit_to_ctx
+        ! starpu_task_finished
+        ! starpu_task_wait
+        ! starpu_task_wait_for_all
+        INTERFACE starpu_task_wait_for_all_c
+                SUBROUTINE starpu_task_wait_for_all() BIND(C)
+                END SUBROUTINE starpu_task_wait_for_all
+        END INTERFACE
+        ! starpu_task_wait_for_n_submitted
+        ! starpu_task_wait_for_all_in_ctx
+        ! starpu_task_wait_for_n_submitted_in_ctx
+        ! starpu_task_wait_for_no_ready
+        ! starpu_task_nready
+        ! starpu_task_nsubmitted
+        ! starpu_codelet_init
+        ! starpu_codelet_display_stats
+        ! starpu_task_get_current
+        ! starpu_parallel_task_barrier_init
+        ! starpu_parallel_task_barrier_init_n
+        ! starpu_task_dup
+        ! starpu_task_set_implementation
+        ! starpu_task_get_implementation
+
+END MODULE mod_starpu
+