├── AUTHORS ├── COPYING.LGPL ├── ChangeLog ├── Makefile.am ├── README ├── acinclude.m4 ├── autogen.sh ├── build-aux └── compile ├── configure.ac ├── doc ├── Gantt ├── Makefile.am ├── starpu.css ├── starpu.texi ├── vector_scal_c.texi ├── vector_scal_cpu.texi ├── vector_scal_cuda.texi ├── vector_scal_opencl.texi └── vector_scal_opencl_codelet.texi ├── examples ├── Makefile.am ├── audio │ ├── Makefile │ ├── input.wav │ └── starpu_audio_processing.c ├── axpy │ └── axpy.c ├── basic_examples │ ├── block.c │ ├── block_cpu.c │ ├── block_cuda.cu │ ├── block_opencl.c │ ├── block_opencl_kernel.cl │ ├── hello_world.c │ ├── mult.c │ ├── variable.c │ ├── variable_kernels.cu │ ├── variable_kernels_cpu.c │ ├── variable_kernels_opencl.c │ ├── variable_kernels_opencl_codelet.cl │ ├── vector_scal.c │ ├── vector_scal_cpu.c │ ├── vector_scal_cuda.cu │ ├── vector_scal_opencl.c │ └── vector_scal_opencl_codelet.cl ├── cholesky │ ├── dw_cholesky.c │ ├── dw_cholesky.h │ ├── dw_cholesky_grain.c │ ├── dw_cholesky_kernels.c │ ├── dw_cholesky_models.c │ ├── dw_cholesky_models.h │ └── dw_cholesky_no_stride.c ├── common │ ├── blas.c │ ├── blas.h │ ├── blas_model.c │ └── blas_model.h ├── coverage │ └── coverage.sh ├── filters │ ├── fblock.c │ ├── fblock_cpu.c │ ├── fblock_cuda.cu │ ├── fblock_opencl.c │ ├── fblock_opencl_codelet.cl │ ├── fmatrix.c │ └── fvector.c ├── fortran │ └── bindings │ │ ├── Makefile │ │ ├── StarPU_fortran.h │ │ ├── hello.F │ │ └── hello_c.c ├── gordon │ ├── null.h │ └── null_kernel_gordon.c ├── heat │ ├── dw_factolu.c │ ├── dw_factolu.h │ ├── dw_factolu_grain.c │ ├── dw_factolu_kernels.c │ ├── dw_factolu_tag.c │ ├── dw_sparse_cg.c │ ├── dw_sparse_cg.h │ ├── dw_sparse_cg_kernels.c │ ├── heat.c │ ├── heat.h │ ├── heat_display.c │ ├── lu_kernels_model.c │ └── lu_kernels_model.h ├── incrementer │ ├── incrementer.c │ ├── incrementer_kernels.cu │ ├── incrementer_kernels_opencl.c │ └── incrementer_kernels_opencl_codelet.cl ├── lu │ ├── dlu.c │ ├── dlu_implicit.c │ ├── dlu_implicit_pivot.c │ ├── dlu_kernels.c │ ├── dlu_pivot.c │ ├── double.h │ ├── float.h │ ├── lu_example.c │ ├── lu_example_double.c │ ├── lu_example_float.c │ ├── slu.c │ ├── slu_implicit.c │ ├── slu_implicit_pivot.c │ ├── slu_kernels.c │ ├── slu_pivot.c │ ├── xlu.c │ ├── xlu.h │ ├── xlu_implicit.c │ ├── xlu_implicit_pivot.c │ ├── xlu_kernels.c │ ├── xlu_kernels.h │ └── xlu_pivot.c ├── matvecmult │ ├── matvecmult.c │ └── matvecmult_kernel.cl ├── mult │ ├── dgemm.c │ ├── dw_mult.c │ ├── dw_mult.h │ ├── dw_mult_no_stride.c │ ├── dw_mult_no_stride_no_tag.c │ ├── gordon │ │ ├── func_sgemm_ibm.c │ │ └── func_sgemm_ibm.h │ ├── sgemm.c │ ├── sgemm_kernels.c │ ├── xgemm.c │ └── xgemm_kernels.c ├── pi │ ├── SobolQRNG │ │ ├── CforCUDA_SDK_license.txt │ │ ├── sobol.h │ │ ├── sobol_gold.c │ │ ├── sobol_gold.h │ │ ├── sobol_gpu.cu │ │ ├── sobol_gpu.h │ │ ├── sobol_primitives.c │ │ └── sobol_primitives.h │ ├── pi.c │ ├── pi.h │ └── pi_kernel.cu ├── ppm_downscaler │ ├── ppm_downscaler.c │ ├── ppm_downscaler.h │ ├── yuv_downscaler.c │ └── yuv_downscaler.h ├── profiling │ └── profiling.c ├── scheduler │ └── dummy_sched.c ├── spmv │ ├── dw_block_spmv.c │ ├── dw_block_spmv.h │ ├── dw_block_spmv_kernels.c │ ├── dw_spmv.c │ ├── dw_spmv.h │ ├── matrix_market │ │ ├── example_read.c │ │ ├── examples │ │ │ └── fidapm05.mtx │ │ ├── mm_to_bcsr.c │ │ ├── mm_to_bcsr.h │ │ ├── mmio.c │ │ └── mmio.h │ ├── spmv_cuda.cu │ └── spmv_opencl.cl ├── starpufft │ ├── Makefile.am │ ├── cuda_kernels.cu │ ├── cudaf_kernels.cu │ ├── cudax_kernels.cu │ ├── cudax_kernels.h │ ├── double.h │ ├── float.h │ ├── starpufft.c │ ├── starpufft.h │ ├── starpufft_common.c │ ├── starpufftf.c │ ├── starpufftx.c │ ├── starpufftx1d.c │ ├── starpufftx2d.c │ ├── test.c │ ├── test_threads.c │ ├── testf.c │ ├── testf_threads.c │ ├── testx.c │ └── testx_threads.c ├── stencil │ ├── 0.5.out │ ├── 0.out │ ├── 1.out │ ├── 2.out │ ├── 3.out │ ├── 4.out │ ├── 6.out │ ├── Makefile.am │ ├── README │ ├── life.c │ ├── life_cuda.cu │ ├── mpi.out │ ├── results │ ├── run │ ├── shadow.cu │ ├── shadow.h │ ├── stencil-blocks.c │ ├── stencil-kernels.c │ ├── stencil-tasks.c │ ├── stencil.c │ └── stencil.h └── tag_example │ ├── tag_example.c │ ├── tag_example2.c │ ├── tag_example3.c │ └── tag_restartable.c ├── include ├── pthread_win32 │ ├── pthread.h │ └── semaphore.h ├── starpu.h ├── starpu_bound.h ├── starpu_config.h.in ├── starpu_cuda.h ├── starpu_data.h ├── starpu_data_filters.h ├── starpu_data_interfaces.h ├── starpu_event.h ├── starpu_expert.h ├── starpu_opencl.h ├── starpu_perfmodel.h ├── starpu_profiling.h ├── starpu_scheduler.h ├── starpu_task.h ├── starpu_task_list.h └── starpu_util.h ├── libstarpu.pc.in ├── m4 └── pkg.m4 ├── mpi ├── Makefile.am ├── examples │ ├── mpi_lu │ │ ├── double.h │ │ ├── float.h │ │ ├── pdlu.c │ │ ├── pdlu_kernels.c │ │ ├── plu_example.c │ │ ├── plu_example_double.c │ │ ├── plu_example_float.c │ │ ├── plu_solve.c │ │ ├── plu_solve_double.c │ │ ├── plu_solve_float.c │ │ ├── pslu.c │ │ ├── pslu_kernels.c │ │ ├── pxlu.c │ │ ├── pxlu.h │ │ ├── pxlu_kernels.c │ │ ├── pxlu_kernels.h │ │ └── slu_kernels.c │ └── perf.sh ├── starpu_mpi.c ├── starpu_mpi.h ├── starpu_mpi_datatype.c ├── starpu_mpi_datatype.h ├── starpu_mpi_fxt.h ├── starpu_mpi_helper.c ├── starpu_mpi_private.h └── tests │ ├── block_interface.c │ ├── block_interface_pinned.c │ ├── mpi_detached_tag.c │ ├── mpi_irecv.c │ ├── mpi_irecv_detached.c │ ├── mpi_isend.c │ ├── mpi_isend_detached.c │ ├── mpi_test.c │ ├── pingpong.c │ ├── ring.c │ ├── ring_async.c │ ├── ring_async_implicit.c │ └── ring_kernel.cu ├── src ├── Makefile.am ├── common │ ├── common.h │ ├── fxt.c │ ├── fxt.h │ ├── hash.c │ ├── hash.h │ ├── htable32.c │ ├── htable32.h │ ├── list.h │ ├── rwlock.c │ ├── rwlock.h │ ├── starpu_spinlock.c │ ├── starpu_spinlock.h │ ├── timing.c │ ├── timing.h │ ├── utils.c │ └── utils.h ├── core │ ├── debug.c │ ├── debug.h │ ├── dependencies │ │ ├── data_concurrency.c │ │ ├── data_concurrency.h │ │ ├── implicit_data_deps.c │ │ ├── implicit_data_deps.h │ │ └── task_deps.c │ ├── errorcheck.c │ ├── errorcheck.h │ ├── event.c │ ├── event.h │ ├── event_callback.c │ ├── event_group.c │ ├── jobs.c │ ├── jobs.h │ ├── perfmodel │ │ ├── perfmodel.c │ │ ├── perfmodel.h │ │ ├── perfmodel_bus.c │ │ ├── perfmodel_history.c │ │ ├── regression.c │ │ └── regression.h │ ├── priorities.c │ ├── progress_hook.c │ ├── sched_policy.c │ ├── sched_policy.h │ ├── task.c │ ├── task.h │ ├── topology.c │ ├── topology.h │ ├── trigger.c │ ├── trigger.h │ ├── workers.c │ └── workers.h ├── datawizard │ ├── coherency.c │ ├── coherency.h │ ├── copy_driver.c │ ├── copy_driver.h │ ├── data_request.c │ ├── data_request.h │ ├── datastats.c │ ├── datastats.h │ ├── datawizard.h │ ├── filters.c │ ├── filters.h │ ├── footprint.c │ ├── footprint.h │ ├── interfaces │ │ ├── Makefile │ │ ├── bcsr_filters.c │ │ ├── bcsr_interface.c │ │ ├── block_filters.c │ │ ├── block_interface.c │ │ ├── csr_filters.c │ │ ├── csr_interface.c │ │ ├── data_interface.c │ │ ├── data_interface.h │ │ ├── matrix_filters.c │ │ ├── matrix_interface.c │ │ ├── variable_interface.c │ │ ├── vector_filters.c │ │ └── vector_interface.c │ ├── memalloc.c │ ├── memalloc.h │ ├── memory_nodes.c │ ├── memory_nodes.h │ ├── progress.c │ ├── sort_data_handles.c │ ├── sort_data_handles.h │ ├── user_interactions.c │ ├── write_back.c │ └── write_back.h ├── debug │ └── latency.c ├── dolib.c ├── drivers │ ├── common │ │ ├── common.c │ │ └── common.h │ ├── cpu │ │ ├── cpu.c │ │ └── cpu.h │ ├── cuda │ │ ├── cuda.c │ │ ├── cuda.h │ │ ├── event.c │ │ └── event.h │ ├── gordon │ │ ├── .externals │ │ ├── gordon.c │ │ ├── gordon.h │ │ └── gordon_interface.h │ └── opencl │ │ ├── event.c │ │ ├── event.h │ │ ├── opencl.c │ │ ├── opencl.h │ │ ├── utils.c │ │ └── utils.h ├── profiling │ ├── bound.c │ ├── bound.h │ ├── bus_profiling_helpers.c │ ├── profiling.c │ └── profiling.h ├── sched_policies │ ├── deque_modeling_policy_data_aware.c │ ├── deque_queues.c │ ├── deque_queues.h │ ├── eager_central_policy.c │ ├── eager_central_priority_policy.c │ ├── fifo_queues.c │ ├── fifo_queues.h │ ├── random_policy.c │ ├── stack_queues.c │ ├── stack_queues.h │ └── work_stealing_policy.c └── util │ ├── execute_on_all.c │ ├── file.c │ ├── malloc.c │ ├── starpu_cublas.c │ ├── starpu_insert_task.c │ └── starpu_task_list.c ├── tests ├── Makefile.am ├── cholesky │ ├── gnuplot_sched.sh │ ├── prio.r │ ├── sched.r │ ├── sched.sh │ └── sched_one_gpu.sh ├── core │ ├── declare_deps_after_submission.c │ ├── declare_deps_after_submission_synchronous.c │ ├── declare_deps_in_callback.c │ ├── empty_task.c │ ├── empty_task_chain.c │ ├── empty_task_sync_point.c │ ├── event_callback.c │ ├── event_callback_blocking.c │ ├── execute_on_a_specific_worker.c │ ├── get_current_task.c │ ├── multithreaded.c │ ├── regenerate.c │ ├── restart.c │ ├── starpu_task_wait.c │ ├── starpu_task_wait_for_all.c │ ├── static_restartable.c │ ├── static_restartable_using_initializer.c │ ├── subgraph_repeat.c │ ├── subgraph_repeat_regenerate.c │ ├── task_wait_api.c │ └── wait_all_regenerable_tasks.c ├── coverage │ └── coverage_test.sh.in ├── datawizard │ ├── acquire_release.c │ ├── cuda_codelet_unsigned_inc.cu │ ├── data_implicit_deps.c │ ├── data_invalidation.c │ ├── dining_philosophers.c │ ├── dsm_stress.c │ ├── mpi_like.c │ ├── mpi_like_async.c │ ├── readers_and_writers.c │ ├── scratch.c │ ├── scratch_cuda.cu │ ├── sync_and_notify_data.c │ ├── sync_and_notify_data_gordon_kernels.c │ ├── sync_and_notify_data_implicit.c │ ├── sync_and_notify_data_kernels.cu │ ├── sync_and_notify_data_opencl.c │ ├── sync_and_notify_data_opencl_codelet.cl │ ├── sync_with_data_with_mem.c │ ├── sync_with_data_with_mem_non_blocking.c │ ├── sync_with_data_with_mem_non_blocking_implicit.c │ ├── unpartition.c │ ├── user_interaction_implicit.c │ └── write_only_tmp_buffer.c ├── errorcheck │ ├── invalid_blocking_calls.c │ ├── invalid_tasks.c │ └── starpu_init_noworker.c ├── experiments │ ├── bandwidth_cuda │ │ ├── Makefile │ │ ├── bench_bandwidth.gp │ │ ├── bench_bandwidth.sh │ │ ├── bench_bandwidth_strided.gp │ │ └── cuda_bandwidth.c │ └── latency │ │ ├── Makefile │ │ └── cuda_latency.c ├── heat │ ├── deps.r │ ├── deps.sh │ ├── dmda.sh │ ├── dmda_gnuplot.sh │ ├── gflops.gp │ ├── gflops.sh │ ├── gflops_sched.gp │ ├── gflops_sched.sh │ ├── granularity.r │ ├── granularity.sh │ ├── granularity_gnuplot.sh │ ├── granularity_model.r │ ├── heat.sh │ ├── model.r │ ├── model_perturbation.sh │ ├── perturbate.r │ ├── random.r │ ├── sched.r │ ├── sched.sh │ ├── sched_gnuplot.sh │ ├── speedup.gp │ ├── speedup.sh │ ├── speedup_barracuda.gp │ ├── speedup_hagrid.gp │ └── time.gp ├── helper │ ├── cublas_init.c │ ├── execute_on_all.c │ └── pinned_memory.c ├── incrementer │ └── speed.sh ├── memory │ ├── memstress.gp │ ├── memstress.sh │ ├── memstress2.gp │ └── memstress2.sh ├── microbenchs │ ├── async_tasks_overhead.c │ ├── local_pingpong.c │ ├── null_kernel_gordon.c │ ├── prefetch_data_on_node.c │ ├── redundant_buffer.c │ ├── starpu_check.sh │ ├── sync_tasks_overhead.c │ └── tasks_overhead.c ├── mult │ ├── gflops.gp │ ├── gflops.sh │ ├── random.r │ ├── sched.gp │ ├── sched.r │ ├── sched.sh │ ├── speedup.gp │ └── speedup.sh ├── overlap │ └── overlap.c ├── perf_models │ ├── bench_sgemm.sh │ ├── error_model.gp │ └── error_model.sh └── regression │ ├── profiles.build.only.in │ ├── profiles.in │ ├── regression.sh.in │ └── regression_test.sh └── tools ├── Makefile.am ├── activity.sh ├── calibrate_bus.c ├── dag_dot.c ├── distrib ├── distrib.r └── distrib.sh ├── fxt_stats.c ├── fxt_tool.c ├── fxt_tool.h ├── fxt_tool_common.c ├── fxt_tool_mpi.c ├── histo.sh ├── histo_paje.c ├── histo_paje.h ├── model.sh ├── model_distrib.sh ├── perfmodel_display.c ├── perfmodel_display_gnuplot.sh ├── rename.sed ├── rename.sh └── sampling.sh /AUTHORS: -------------------------------------------------------------------------------- 1 | Cédric Augonnet 2 | Jérôme Clet-Ortega 3 | Nathalie Furmento 4 | Sylvain Henry 5 | Mehdi Juhoor 6 | Samuel Thibault 7 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # StarPU 3 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; either version 2.1 of the License, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # 14 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | # 16 | 17 | ACLOCAL_AMFLAGS=-I m4 18 | CLEANFILES = *.gcno *.gcda *.linkinfo 19 | 20 | SUBDIRS = src 21 | if USE_MPI 22 | #SUBDIRS += mpi 23 | endif 24 | SUBDIRS += tools examples tests doc 25 | 26 | pkgconfigdir = $(libdir)/pkgconfig 27 | pkgconfig_DATA = libstarpu.pc 28 | 29 | include_HEADERS = \ 30 | include/starpu.h \ 31 | include/starpu_event.h \ 32 | include/starpu_config.h \ 33 | include/starpu_data_filters.h \ 34 | include/starpu_data_interfaces.h \ 35 | include/starpu_task.h \ 36 | include/starpu_task_list.h \ 37 | include/starpu_data.h \ 38 | include/starpu_perfmodel.h \ 39 | include/starpu_util.h \ 40 | include/starpu_cuda.h \ 41 | include/starpu_opencl.h \ 42 | include/starpu_expert.h \ 43 | include/starpu_profiling.h \ 44 | include/starpu_bound.h \ 45 | include/starpu_scheduler.h 46 | 47 | noinst_HEADERS = \ 48 | include/pthread_win32/pthread.h \ 49 | include/pthread_win32/semaphore.h 50 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | : 2 | autoreconf -ivf -I m4 3 | 4 | -------------------------------------------------------------------------------- /doc/Gantt: -------------------------------------------------------------------------------- 1 | Step 1 - Install FxT 2 | 3 | Get the sources from the cvs repository 4 | cvs -d :pserver:anonymous@cvs.sv.gnu.org:/sources/fkt co FxT 5 | 6 | Configure and compile FxT: 7 | ./bootstrap 8 | ./configure --prefix=$FXTDIR 9 | make 10 | make install 11 | 12 | Step 2 - Configure StarPU to use FxT 13 | 14 | ./configure --with-fxt=/home/gonnet/hannibal/Libs/FxT/FxT/target/ 15 | 16 | Step 3 - Execute applications as usual 17 | 18 | - If the application was properly terminated (ie. starpu_shutdown was called), 19 | there should be a file named "/tmp/prof_file_user_". 20 | 21 | - Call tools/fxt_tool on that file 22 | ./tools/fxt_tool -i /tmp/prof_file_user_yourlogin 23 | 24 | - Some files should have been created in the current directory 25 | - paje.trace : A Gantt diagram of the execution 26 | $ vite paje.trace 27 | - dag.dot : A graphviz graph of the task dependencies (according to tags) 28 | $ dot -Tpdf dag.dot -o dag.pdf 29 | -------------------------------------------------------------------------------- /doc/vector_scal_cpu.texi: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* This kernel takes a buffer and scales it by a constant factor */ 4 | void scal_cpu_func(void *buffers[], void *cl_arg) 5 | @{ 6 | unsigned i; 7 | float *factor = cl_arg; 8 | 9 | /* 10 | * The "buffers" array matches the task->buffers array: for instance 11 | * task->buffers[0].handle is a handle that corresponds to a data with 12 | * vector "interface", so that the first entry of the array in the 13 | * codelet is a pointer to a structure describing such a vector (ie. 14 | * struct starpu_vector_interface_s *). Here, we therefore manipulate 15 | * the buffers[0] element as a vector: nx gives the number of elements 16 | * in the array, ptr gives the location of the array (that was possibly 17 | * migrated/replicated), and elemsize gives the size of each elements. 18 | */ 19 | starpu_vector_interface_t *vector = buffers[0]; 20 | 21 | /* length of the vector */ 22 | unsigned n = STARPU_VECTOR_GET_NX(vector); 23 | 24 | /* get a pointer to the local copy of the vector : note that we have to 25 | * cast it in (float *) since a vector could contain any type of 26 | * elements so that the .ptr field is actually a uintptr_t */ 27 | float *val = (float *)STARPU_VECTOR_GET_PTR(vector); 28 | 29 | /* scale the vector */ 30 | for (i = 0; i < n; i++) 31 | val[i] *= *factor; 32 | @} 33 | -------------------------------------------------------------------------------- /doc/vector_scal_cuda.texi: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static __global__ void vector_mult_cuda(float *val, unsigned n, 4 | float factor) 5 | @{ 6 | unsigned i; 7 | for(i = 0 ; i < n ; i++) 8 | val[i] *= factor; 9 | @} 10 | 11 | extern "C" void scal_cuda_func(void *buffers[], void *_args) 12 | @{ 13 | float *factor = (float *)_args; 14 | 15 | /* length of the vector */ 16 | unsigned n = STARPU_VECTOR_GET_NX(buffers[0]); 17 | /* local copy of the vector pointer */ 18 | float *val = (float *)STARPU_VECTOR_GET_PTR(buffers[0]); 19 | 20 | vector_mult_cuda<<<1,1>>>(val, n, *factor); 21 | 22 | cudaThreadSynchronize(); 23 | @} 24 | -------------------------------------------------------------------------------- /doc/vector_scal_opencl.texi: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern struct starpu_opencl_program programs; 5 | 6 | void scal_opencl_func(void *buffers[], void *_args) 7 | @{ 8 | float *factor = _args; 9 | int id, devid, err; 10 | cl_kernel kernel; 11 | cl_command_queue queue; 12 | 13 | /* length of the vector */ 14 | unsigned n = STARPU_VECTOR_GET_NX(buffers[0]); 15 | /* local copy of the vector pointer */ 16 | float *val = (float *)STARPU_VECTOR_GET_PTR(buffers[0]); 17 | 18 | id = starpu_worker_get_id(); 19 | devid = starpu_worker_get_devid(id); 20 | 21 | err = starpu_opencl_load_kernel(&kernel, &queue, &programs, "vector_mult_opencl", devid); 22 | if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); 23 | 24 | err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &val); 25 | err |= clSetKernelArg(kernel, 1, sizeof(n), &n); 26 | err |= clSetKernelArg(kernel, 2, sizeof(*factor), factor); 27 | if (err) STARPU_OPENCL_REPORT_ERROR(err); 28 | 29 | @{ 30 | size_t global=n; 31 | size_t local=n; 32 | err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, &local, 0, NULL, NULL); 33 | if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); 34 | @} 35 | 36 | clFinish(queue); 37 | 38 | starpu_opencl_release_kernel(kernel); 39 | @} 40 | -------------------------------------------------------------------------------- /doc/vector_scal_opencl_codelet.texi: -------------------------------------------------------------------------------- 1 | __kernel void vector_mult_opencl(__global float* val, int nx, float factor) 2 | @{ 3 | const int i = get_global_id(0); 4 | if (i < nx) @{ 5 | val[i] *= factor; 6 | @} 7 | @} 8 | -------------------------------------------------------------------------------- /examples/audio/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -Wall -g3 -gdwarf-2 -O3 2 | 3 | LIBS+=$$(pkg-config --libs libstarpu) -lcufft 4 | CFLAGS+=$$(pkg-config --cflags libstarpu) 5 | 6 | LIBS+=$$(pkg-config --libs fftw3f) 7 | CFLAGS+=$$(pkg-config --cflags fftw3f) 8 | 9 | all: starpu_audio_processing 10 | 11 | starpu_audio_processing.o: starpu_audio_processing.c 12 | 13 | starpu_audio_processing: starpu_audio_processing.o 14 | $(CC) $(LDFLAGS) starpu_audio_processing.o -o starpu_audio_processing $(LIBS) 15 | 16 | clean: 17 | rm -f *.o 18 | rm -f starpu_audio_processing 19 | rm -f input.dat input.raw 20 | rm -f output.dat output.wav output.raw 21 | -------------------------------------------------------------------------------- /examples/audio/input.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alucas/StarPU/0009efe61634bf83552c263a6df8ee3168cd9647/examples/audio/input.wav -------------------------------------------------------------------------------- /examples/basic_examples/block_cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | void cpu_codelet(void *descr[], void *_args) 20 | { 21 | float *block = (float *)STARPU_BLOCK_GET_PTR(descr[0]); 22 | int nx = (int)STARPU_BLOCK_GET_NX(descr[0]); 23 | int ny = (int)STARPU_BLOCK_GET_NY(descr[0]); 24 | int nz = (int)STARPU_BLOCK_GET_NZ(descr[0]); 25 | unsigned ldy = STARPU_BLOCK_GET_LDY(descr[0]); 26 | unsigned ldz = STARPU_BLOCK_GET_LDZ(descr[0]); 27 | float *multiplier = (float *)_args; 28 | int i, j, k; 29 | 30 | for(k=0; k 18 | 19 | static __global__ void cuda_block(float *block, int nx, int ny, int nz, unsigned ldy, unsigned ldz, float multiplier) 20 | { 21 | int i, j, k; 22 | for(k=0; k>>(block, nx, ny, nz, ldy, ldz, *multiplier); 41 | cudaThreadSynchronize(); 42 | } 43 | -------------------------------------------------------------------------------- /examples/basic_examples/block_opencl_kernel.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void block(__global float *b, int nx, int ny, int nz, unsigned ldy, unsigned ldz, float multiplier) 18 | { 19 | int i, j, k; 20 | for(k=0; k 18 | 19 | static __global__ void cuda_variable(float * tab) 20 | { 21 | *tab += 1.0; 22 | return; 23 | } 24 | 25 | extern "C" void cuda_codelet(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args) 26 | { 27 | float *val = (float *)STARPU_VARIABLE_GET_PTR(descr[0]); 28 | 29 | cuda_variable<<<1,1>>>(val); 30 | } 31 | -------------------------------------------------------------------------------- /examples/basic_examples/variable_kernels_cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | void cpu_codelet(void *descr[], __attribute__ ((unused)) void *_args) 20 | { 21 | float *val = (float *)STARPU_VARIABLE_GET_PTR(descr[0]); 22 | 23 | *val += 1.0f; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /examples/basic_examples/variable_kernels_opencl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | extern struct starpu_opencl_program opencl_code; 21 | void opencl_codelet(void *descr[], void *_args) 22 | { 23 | float *val = (float *)STARPU_VARIABLE_GET_PTR(descr[0]); 24 | cl_kernel kernel; 25 | cl_command_queue queue; 26 | int id, devid, err; 27 | 28 | id = starpu_worker_get_id(); 29 | devid = starpu_worker_get_devid(id); 30 | 31 | err = starpu_opencl_load_kernel(&kernel, &queue, &opencl_code, "variable", devid); 32 | if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); 33 | 34 | err = 0; 35 | err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &val); 36 | if (err) STARPU_OPENCL_REPORT_ERROR(err); 37 | 38 | { 39 | size_t global=1; 40 | size_t local=1; 41 | err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, &local, 0, NULL, NULL); 42 | if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err); 43 | } 44 | 45 | clFinish(queue); 46 | 47 | starpu_opencl_release_kernel(kernel); 48 | } 49 | -------------------------------------------------------------------------------- /examples/basic_examples/variable_kernels_opencl_codelet.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void variable(__global float* input) 18 | { 19 | const int i = get_global_id(0); 20 | if (i == 0) 21 | input[i] = input[i] + 1.0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /examples/basic_examples/vector_scal_cuda.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | /* 18 | * This example complements vector_scale.c: here we implement a CUDA version. 19 | */ 20 | 21 | #include 22 | 23 | static __global__ void vector_mult_cuda(float *val, unsigned n, 24 | float factor) 25 | { 26 | unsigned i; 27 | for(i = 0 ; i < n ; i++) 28 | val[i] *= factor; 29 | } 30 | 31 | extern "C" void scal_cuda_func(void *buffers[], void *_args) 32 | { 33 | float *factor = (float *)_args; 34 | 35 | /* length of the vector */ 36 | unsigned n = STARPU_VECTOR_GET_NX(buffers[0]); 37 | /* local copy of the vector pointer */ 38 | float *val = (float *)STARPU_VECTOR_GET_PTR(buffers[0]); 39 | 40 | /* TODO: use more blocks and threads in blocks */ 41 | vector_mult_cuda<<<1,1>>>(val, n, *factor); 42 | 43 | cudaThreadSynchronize(); 44 | } 45 | -------------------------------------------------------------------------------- /examples/basic_examples/vector_scal_opencl_codelet.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void vector_mult_opencl(__global float* val, int nx, float factor) 18 | { 19 | const int i = get_global_id(0); 20 | if (i < nx) { 21 | val[i] *= factor; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/cholesky/dw_cholesky_models.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DW_CHOLESKY_MODELS_H__ 18 | #define __DW_CHOLESKY_MODELS_H__ 19 | 20 | #include 21 | 22 | #endif // __DW_CHOLESKY_MODELS_H__ 23 | -------------------------------------------------------------------------------- /examples/common/blas_model.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "blas_model.h" 18 | #include 19 | 20 | /* 21 | * As a convention, in that file, descr[0] is represented by A, 22 | * descr[1] is B ... 23 | */ 24 | 25 | /* 26 | * Number of flops of Gemm 27 | */ 28 | 29 | double gemm_cost(starpu_buffer_descr *descr) 30 | { 31 | /* C = A * B */ 32 | uint32_t nxC, nyC, nxA; 33 | 34 | 35 | nxC = starpu_matrix_get_nx(descr[2].handle); 36 | nyC = starpu_matrix_get_ny(descr[2].handle); 37 | nxA = starpu_matrix_get_nx(descr[0].handle); 38 | 39 | // printf("nxC %d nxC %d nxA %d\n", nxC, nyC, nxA); 40 | 41 | double cost = ((double)nxC)*((double)nyC)*((double)nxA/1000.0f/4.11f); 42 | 43 | // printf("cost %e \n", cost); 44 | 45 | return cost; 46 | } 47 | -------------------------------------------------------------------------------- /examples/common/blas_model.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __BLAS_MODEL_H__ 18 | #define __BLAS_MODEL_H__ 19 | 20 | #include 21 | 22 | double gemm_cost(starpu_buffer_descr *descr); 23 | 24 | static struct starpu_perfmodel_t sgemm_model = { 25 | .cost_model = gemm_cost, 26 | .type = STARPU_HISTORY_BASED, 27 | #ifdef STARPU_ATLAS 28 | .symbol = "sgemm_atlas" 29 | #elif defined(STARPU_GOTO) 30 | .symbol = "sgemm_goto" 31 | #else 32 | .symbol = "sgemm" 33 | #endif 34 | }; 35 | 36 | static struct starpu_perfmodel_t sgemm_model_common = { 37 | .cost_model = gemm_cost, 38 | .type = STARPU_COMMON, 39 | }; 40 | 41 | #endif // __BLAS_MODEL_H__ 42 | -------------------------------------------------------------------------------- /examples/filters/fblock_cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | void cpu_func(void *buffers[], void *cl_arg) 20 | { 21 | int i, j, k; 22 | int *factor = cl_arg; 23 | int *block = (int *)STARPU_BLOCK_GET_PTR(buffers[0]); 24 | int nx = (int)STARPU_BLOCK_GET_NX(buffers[0]); 25 | int ny = (int)STARPU_BLOCK_GET_NY(buffers[0]); 26 | int nz = (int)STARPU_BLOCK_GET_NZ(buffers[0]); 27 | unsigned ldy = STARPU_BLOCK_GET_LDY(buffers[0]); 28 | unsigned ldz = STARPU_BLOCK_GET_LDZ(buffers[0]); 29 | 30 | for(k=0; k 18 | 19 | static __global__ void fblock_cuda(int *block, int nx, int ny, int nz, unsigned ldy, unsigned ldz, float factor) 20 | { 21 | int i, j, k; 22 | for(k=0; k>>(block, nx, ny, nz, ldy, ldz, *factor); 42 | 43 | cudaThreadSynchronize(); 44 | } 45 | -------------------------------------------------------------------------------- /examples/filters/fblock_opencl_codelet.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void fblock_opencl(__global int* block, int nx, int ny, int nz, unsigned ldy, unsigned ldz, int factor) 18 | { 19 | int i, j, k; 20 | for(k=0; k 21 | #include 22 | #include 23 | 24 | #define NSHOT_PER_TASK (16*1024*1024ULL) 25 | 26 | #define TYPE float 27 | 28 | //extern "C" void cuda_kernel(void *descr[], void *cl_arg); 29 | 30 | static int n_dimensions = 100; 31 | 32 | #endif // __PI_H__ 33 | -------------------------------------------------------------------------------- /examples/ppm_downscaler/ppm_downscaler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | /* we make the asumption that there are 256 color levels at most */ 18 | struct ppm_color { 19 | unsigned char r; 20 | unsigned char g; 21 | unsigned char b; 22 | }; 23 | 24 | struct ppm_image { 25 | int nlines; 26 | int ncols; 27 | int coldepth; 28 | struct ppm_color *data; 29 | }; 30 | -------------------------------------------------------------------------------- /examples/ppm_downscaler/yuv_downscaler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #define WIDTH 1920 18 | #define HEIGHT 1080 19 | 20 | #define FACTOR 2 21 | 22 | #define NEW_WIDTH (WIDTH/FACTOR) 23 | #define NEW_HEIGHT (HEIGHT/FACTOR) 24 | 25 | #define BLOCK_HEIGHT 20 26 | 27 | #include 28 | 29 | struct yuv_frame { 30 | uint8_t y[WIDTH*HEIGHT]; 31 | uint8_t u[(WIDTH*HEIGHT)/4]; 32 | uint8_t v[(WIDTH*HEIGHT)/4]; 33 | }; 34 | 35 | struct yuv_new_frame { 36 | uint8_t y[NEW_WIDTH*NEW_HEIGHT]; 37 | uint8_t u[(NEW_WIDTH*NEW_HEIGHT)/4]; 38 | uint8_t v[(NEW_WIDTH*NEW_HEIGHT)/4]; 39 | }; 40 | -------------------------------------------------------------------------------- /examples/spmv/dw_block_spmv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DW_BLOCK_SPMV_H__ 18 | #define __DW_BLOCK_SPMV_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #ifdef STARPU_USE_CUDA 32 | #include 33 | #endif 34 | 35 | void cpu_block_spmv(void *descr[], void *_args); 36 | 37 | #ifdef STARPU_USE_CUDA 38 | void cublas_block_spmv(void *descr[], void *_args); 39 | #endif // STARPU_USE_CUDA 40 | 41 | #endif // __DW_BLOCK_SPMV_H__ 42 | -------------------------------------------------------------------------------- /examples/spmv/dw_spmv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DW_SPARSE_CG_H__ 18 | #define __DW_SPARSE_CG_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #endif // __DW_SPARSE_CG_H__ 32 | -------------------------------------------------------------------------------- /examples/spmv/matrix_market/example_read.c: -------------------------------------------------------------------------------- 1 | #include "mm_to_bcsr.h" 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | unsigned c, r; 6 | 7 | if (argc < 2) 8 | { 9 | fprintf(stderr, "Usage: %s [martix-market-filename] [c] [r]\n", argv[0]); 10 | exit(1); 11 | } 12 | 13 | c = 64; 14 | r = 64; 15 | 16 | bcsr_t *bcsr; 17 | bcsr = mm_file_to_bcsr(argv[1], c, r); 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /examples/spmv/matrix_market/mm_to_bcsr.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "mmio.h" 6 | 7 | /* convert a matrix stored in a file with the matrix market format into the 8 | * BCSR format */ 9 | 10 | typedef struct tmp_block { 11 | /* we have a linked list of blocks */ 12 | struct tmp_block *next; 13 | 14 | /* column i, row j*/ 15 | unsigned i, j; 16 | 17 | float *val; 18 | 19 | } tmp_block_t; 20 | 21 | typedef struct { 22 | unsigned r,c; 23 | unsigned nnz_blocks; 24 | unsigned nrows_blocks; 25 | 26 | float *val; 27 | uint32_t *colind; 28 | uint32_t *rowptr; 29 | } bcsr_t; 30 | 31 | 32 | /* directly read input from a file */ 33 | bcsr_t *mm_file_to_bcsr(char *filename, unsigned c, unsigned r); 34 | 35 | /* read the matrix as a set of valuated coordinates */ 36 | bcsr_t *mm_to_bcsr(unsigned nz, unsigned *I, unsigned *J, float *val, unsigned c, unsigned r); 37 | -------------------------------------------------------------------------------- /examples/spmv/spmv_opencl.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void spvm(unsigned nnz, unsigned nrow, 18 | __global float* nzval, __global unsigned* colind, 19 | __global unsigned* rowptr, unsigned firstentry, 20 | __global float *vecin, unsigned nx_in, 21 | __global float *vecout, unsigned nx_out) 22 | { 23 | unsigned row; 24 | for (row = 0; row < nrow; row++) 25 | { 26 | float tmp = 0.0f; 27 | unsigned index; 28 | 29 | unsigned firstindex = rowptr[row] - firstentry; 30 | unsigned lastindex = rowptr[row+1] - firstentry; 31 | 32 | for (index = firstindex; index < lastindex; index++) 33 | { 34 | unsigned col; 35 | 36 | col = colind[index]; 37 | tmp += nzval[index]*vecin[col]; 38 | } 39 | 40 | vecout[row] = tmp; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/starpufft/cuda_kernels.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "cudax_kernels.cu" 19 | -------------------------------------------------------------------------------- /examples/starpufft/cudaf_kernels.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "cudax_kernels.cu" 19 | -------------------------------------------------------------------------------- /examples/starpufft/cudax_kernels.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | _externC void STARPUFFT(cuda_twist1_1d_host)(const _cuComplex *in, _cuComplex *twisted1, unsigned i, unsigned n1, unsigned n2); 19 | _externC void STARPUFFT(cuda_twiddle_1d_host)(_cuComplex *out, const _cuComplex *roots, unsigned n, unsigned i); 20 | _externC void STARPUFFT(cuda_twist1_2d_host)(const _cuComplex *in, _cuComplex *twisted1, unsigned i, unsigned j, unsigned n1, unsigned n2, unsigned m1, unsigned m2); 21 | _externC void STARPUFFT(cuda_twiddle_2d_host)(_cuComplex *out, const _cuComplex *roots0, const _cuComplex *roots1, unsigned n2, unsigned m2, unsigned i, unsigned j); 22 | -------------------------------------------------------------------------------- /examples/starpufft/double.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #ifdef STARPU_HAVE_FFTW 21 | #include 22 | #endif 23 | 24 | #ifdef STARPU_USE_CUDA 25 | #include 26 | #endif 27 | 28 | typedef double real; 29 | #ifdef STARPU_HAVE_FFTW 30 | typedef fftw_complex _fftw_complex; 31 | typedef fftw_plan _fftw_plan; 32 | #endif 33 | #ifdef STARPU_USE_CUDA 34 | typedef cuDoubleComplex _cuComplex; 35 | typedef cufftDoubleComplex _cufftComplex; 36 | #define _cufftExecC2C cufftExecZ2Z 37 | #define _cufftExecR2C cufftExecD2Z 38 | #define _cufftExecC2R cufftExecZ2D 39 | #define _CUFFT_C2C CUFFT_Z2Z 40 | #define _CUFFT_R2C CUFFT_D2Z 41 | #define _CUFFT_C2R CUFFT_Z2D 42 | #define _cuCmul(x,y) cuCmul(x,y) 43 | #endif 44 | #define STARPUFFT(name) starpufft_##name 45 | #define _FFTW(name) fftw_##name 46 | 47 | #define TYPE "" 48 | -------------------------------------------------------------------------------- /examples/starpufft/float.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #ifdef STARPU_HAVE_FFTW 21 | #include 22 | #endif 23 | 24 | #ifdef STARPU_USE_CUDA 25 | #include 26 | #endif 27 | 28 | typedef float real; 29 | #ifdef STARPU_HAVE_FFTW 30 | typedef fftwf_complex _fftw_complex; 31 | typedef fftwf_plan _fftw_plan; 32 | #endif 33 | #ifdef STARPU_USE_CUDA 34 | typedef cuComplex _cuComplex; 35 | typedef cufftComplex _cufftComplex; 36 | #define _cufftExecC2C cufftExecC2C 37 | #define _cufftExecR2C cufftExecR2C 38 | #define _cufftExecC2R cufftExecC2R 39 | #define _CUFFT_C2C CUFFT_C2C 40 | #define _CUFFT_R2C CUFFT_R2C 41 | #define _CUFFT_C2R CUFFT_C2R 42 | #define _cuCmul(x,y) cuCmulf(x,y) 43 | #endif 44 | #define STARPUFFT(name) starpufftf_##name 45 | #define _FFTW(name) fftwf_##name 46 | 47 | #define TYPE "f" 48 | -------------------------------------------------------------------------------- /examples/starpufft/starpufft.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "starpufftx.c" 19 | -------------------------------------------------------------------------------- /examples/starpufft/starpufft_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "starpufft.h" 18 | 19 | /* Used as an identifier in starpu tags to let plans run concurrently */ 20 | int starpufft_last_plan_number; 21 | -------------------------------------------------------------------------------- /examples/starpufft/starpufftf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "starpufftx.c" 19 | -------------------------------------------------------------------------------- /examples/starpufft/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "testx.c" 19 | -------------------------------------------------------------------------------- /examples/starpufft/test_threads.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "testx_threads.c" 19 | -------------------------------------------------------------------------------- /examples/starpufft/testf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "testx.c" 19 | -------------------------------------------------------------------------------- /examples/starpufft/testf_threads.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR in PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "testx_threads.c" 19 | -------------------------------------------------------------------------------- /examples/stencil/README: -------------------------------------------------------------------------------- 1 | This is a sample 3D stencil application (here just using the game of life rules 2 | for simplicity), split on the z axis. 3 | 4 | This is a suggest order of read: 5 | 6 | life.c 7 | life.cu: Heart of the stencil computation: compute a new state from an old one. 8 | 9 | shadow.cu 10 | shadow.h: Perform replication of data on X and Y edges, to fold the domain on 11 | itself through mere replication of the source state. 12 | 13 | stencil.h: Declarations 14 | 15 | stencil-kernels.c: Computation Kernels 16 | 17 | stencil-blocks.c: Manage block and tags allocation 18 | 19 | stencil-tasks.c: Schedule tasks for updates and saves 20 | 21 | stencil.c: Main application 22 | 23 | *.out: various results according to beta value (communication vs computation 24 | penalty ratio), run make pics or make view to get pictures. 25 | mpi.out: results on MPI. 26 | 27 | results: a few results 28 | -------------------------------------------------------------------------------- /examples/stencil/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ -z "$N" ] && N=1 3 | export N 4 | [ -z "$STARPU_SCHED_BETA" ] && STARPU_SCHED_BETA="2" 5 | export STARPU_SCHED_BETA 6 | echo sched $STARPU_SCHED 1>&2 7 | echo sched_beta $STARPU_SCHED_BETA 1>&2 8 | echo prefetch $STARPU_PREFETCH 1>&2 9 | echo calibrate $STARPU_CALIBRATE 1>&2 10 | echo ncpus $STARPU_NCPUS 1>&2 11 | echo ncuda $STARPU_NCUDA 1>&2 12 | echo N $N 13 | ./stencil -nbz $(($N * 64)) -sizex 128 -sizey 128 -sizez $(( $((16 * $N)) * 128 )) -niter 64 "$@" 14 | -------------------------------------------------------------------------------- /include/starpu_bound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | /* 18 | * Compute theoretical upper computation efficiency bound corresponding to 19 | * some actual execution. 20 | */ 21 | 22 | #ifndef __STARPU_BOUND_H__ 23 | #define __STARPU_BOUND_H__ 24 | 25 | /* Start recording tasks (resets stats) */ 26 | void starpu_bound_start(void); 27 | /* Stop recording tasks */ 28 | void starpu_bound_stop(void); 29 | 30 | /* Get theoretical upper bound (needs glpk support) */ 31 | void starpu_bound_compute(double *res); 32 | 33 | /* Emit Linear Programming system on output for the recorded tasks in lp format */ 34 | void starpu_bound_print_lp(FILE *output); 35 | 36 | /* Emit Linear Programming system on output for the recorded tasks in mps format */ 37 | void starpu_bound_print_mps(FILE *output); 38 | 39 | /* Emit statistics of actual execution vs theoretical upper bound */ 40 | void starpu_bound_print(FILE *output); 41 | 42 | #endif /* __STARPU_BOUND_H__ */ 43 | -------------------------------------------------------------------------------- /include/starpu_config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __STARPU_CONFIG_PUBLIC_H__ 2 | #define __STARPU_CONFIG_PUBLIC_H__ 3 | 4 | #undef STARPU_USE_CPU 5 | #undef STARPU_USE_CUDA 6 | #undef STARPU_USE_OPENCL 7 | #undef STARPU_USE_GORDON 8 | 9 | #undef STARPU_USE_MPI 10 | 11 | #undef STARPU_ATLAS 12 | #undef STARPU_GOTO 13 | #undef STARPU_SYSTEM_BLAS 14 | 15 | #undef STARPU_BUILD_DIR 16 | #undef STARPU_OPENCL_DATADIR 17 | #undef STARPU_HAVE_MAGMA 18 | 19 | #undef STARPU_OPENGL_RENDER 20 | 21 | #undef STARPU_USE_GTK 22 | 23 | #undef STARPU_HAVE_POSIX_MEMALIGN 24 | 25 | #undef STARPU_HAVE_MEMALIGN 26 | 27 | #undef STARPU_HAVE_MALLOC_H 28 | 29 | #undef STARPU_HAVE_SYNC_BOOL_COMPARE_AND_SWAP 30 | #undef STARPU_HAVE_SYNC_FETCH_AND_ADD 31 | #undef STARPU_HAVE_SYNC_FETCH_AND_OR 32 | #undef STARPU_HAVE_SYNC_LOCK_TEST_AND_SET 33 | 34 | #undef STARPU_MODEL_DEBUG 35 | #undef STARPU_NO_ASSERT 36 | 37 | #undef STARPU_HAVE_FFTW 38 | #undef STARPU_HAVE_FFTWF 39 | #undef STARPU_HAVE_FFTWL 40 | 41 | #undef STARPU_NMAXBUFS 42 | #undef STARPU_MAXCUDADEVS 43 | #undef STARPU_MAXOPENCLDEVS 44 | #undef STARPU_NMAXWORKERS 45 | 46 | #undef STARPU_HAVE_HWLOC 47 | 48 | #undef STARPU_HAVE_LIBNUMA 49 | 50 | #undef STARPU_HAVE_WINDOWS 51 | 52 | #undef starpu_drand48 53 | #undef starpu_srand48 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/starpu_expert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __STARPU_EXPERT_H__ 18 | #define __STARPU_EXPERT_H__ 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | void starpu_wake_all_blocked_workers(void); 28 | 29 | int starpu_progression_hook_register(unsigned (*func)(void *arg), void *arg); 30 | void starpu_progression_hook_deregister(int hook_id); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif // __STARPU_H__ 37 | -------------------------------------------------------------------------------- /libstarpu.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: starpu 7 | Description: offers support for heterogeneous multicore architecture 8 | Version: @PACKAGE_VERSION@ 9 | Cflags: -I${includedir} @STARPU_CUDA_CPPFLAGS@ 10 | Libs: -L${libdir} -lstarpu @STARPU_CUDA_LDFLAGS@ 11 | Libs.private: @LDFLAGS@ @LIBS@ 12 | Requires: @HWLOC_REQUIRES@ 13 | Requires.private: @GORDON_REQUIRES@ 14 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/double.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #define TYPE double 18 | #define MPI_TYPE MPI_DOUBLE 19 | 20 | #define STARPU_PLU(name) starpu_pdlu_##name 21 | 22 | #define CUBLAS_GEMM cublasDgemm 23 | #define CUBLAS_TRSM cublasDtrsm 24 | #define CUBLAS_SCAL cublasDscal 25 | #define CUBLAS_GER cublasDger 26 | #define CUBLAS_SWAP cublasDswap 27 | #define CUBLAS_IAMAX cublasIdamax 28 | 29 | #define CPU_GEMM DGEMM 30 | #define CPU_GEMV DGEMV 31 | #define CPU_TRSM DTRSM 32 | #define CPU_SCAL DSCAL 33 | #define CPU_GER DGER 34 | #define CPU_SWAP DSWAP 35 | 36 | #define CPU_TRMM DTRMM 37 | #define CPU_AXPY DAXPY 38 | #define CPU_ASUM DASUM 39 | #define CPU_IAMAX IDAMAX 40 | 41 | #define PIVOT_THRESHHOLD 10e-10 42 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/float.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #define TYPE float 18 | #define MPI_TYPE MPI_FLOAT 19 | 20 | #define STARPU_PLU(name) starpu_pslu_##name 21 | 22 | #define CUBLAS_GEMM cublasSgemm 23 | #define CUBLAS_TRSM cublasStrsm 24 | #define CUBLAS_SCAL cublasSscal 25 | #define CUBLAS_GER cublasSger 26 | #define CUBLAS_SWAP cublasSswap 27 | #define CUBLAS_IAMAX cublasIsamax 28 | 29 | #define CPU_GEMM SGEMM 30 | #define CPU_GEMV SGEMV 31 | #define CPU_TRSM STRSM 32 | #define CPU_SCAL SSCAL 33 | #define CPU_GER SGER 34 | #define CPU_SWAP SSWAP 35 | 36 | #define CPU_TRMM STRMM 37 | #define CPU_AXPY SAXPY 38 | #define CPU_ASUM SASUM 39 | #define CPU_IAMAX ISAMAX 40 | 41 | #define PIVOT_THRESHHOLD 10e-5 42 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/pdlu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "pxlu.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/pdlu_kernels.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "pxlu_kernels.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/plu_example_double.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "plu_example.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/plu_example_float.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "plu_example.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/plu_solve_double.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "double.h" 18 | #include "plu_solve.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/plu_solve_float.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "plu_solve.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/pslu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "pxlu.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/pslu_kernels.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "pxlu_kernels.c" 19 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/pxlu_kernels.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __PXLU_KERNELS_H__ 18 | #define __PXLU_KERNELS_H__ 19 | 20 | #include 21 | 22 | #define str(s) #s 23 | #define xstr(s) str(s) 24 | #define STARPU_PLU_STR(name) xstr(STARPU_PLU(name)) 25 | 26 | starpu_codelet STARPU_PLU(cl11); 27 | starpu_codelet STARPU_PLU(cl12); 28 | starpu_codelet STARPU_PLU(cl21); 29 | starpu_codelet STARPU_PLU(cl22); 30 | 31 | #endif // __PXLU_KERNELS_H__ 32 | -------------------------------------------------------------------------------- /mpi/examples/mpi_lu/slu_kernels.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include "float.h" 18 | #include "xlu_kernels.c" 19 | -------------------------------------------------------------------------------- /mpi/starpu_mpi_datatype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __STARPU_MPI_DATATYPE_H__ 18 | #define __STARPU_MPI_DATATYPE_H__ 19 | 20 | #include 21 | 22 | int starpu_mpi_handle_to_datatype(starpu_data_handle data_handle, MPI_Datatype *datatype); 23 | void *starpu_mpi_handle_to_ptr(starpu_data_handle data_handle); 24 | 25 | #endif // __STARPU_MPI_DATATYPE_H__ 26 | -------------------------------------------------------------------------------- /mpi/starpu_mpi_fxt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __STARPU_MPI_FXT_H__ 18 | #define __STARPU_MPI_FXT_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define FUT_MPI_BARRIER 0x5201 25 | #define FUT_MPI_ISEND 0x5202 26 | #define FUT_MPI_IRECV_END 0x5203 27 | 28 | #ifdef STARPU_USE_FXT 29 | #define TRACE_MPI_BARRIER(rank, worldsize, key) \ 30 | FUT_DO_PROBE4(FUT_MPI_BARRIER, (rank), (worldsize), (key), syscall(SYS_gettid)); 31 | #define TRACE_MPI_ISEND(dest, mpi_tag, size) \ 32 | FUT_DO_PROBE4(FUT_MPI_ISEND, (dest), (mpi_tag), (size), syscall(SYS_gettid)); 33 | #define TRACE_MPI_IRECV_END(src, mpi_tag) \ 34 | FUT_DO_PROBE3(FUT_MPI_IRECV_END, (src), (mpi_tag), syscall(SYS_gettid)); 35 | #define TRACE 36 | #else 37 | #define TRACE_MPI_BARRIER(a, b, c) do {} while(0); 38 | #define TRACE_MPI_ISEND(a, b, c) do {} while(0); 39 | #define TRACE_MPI_IRECV_END(a, b) do {} while(0); 40 | #endif 41 | 42 | 43 | 44 | #endif // __STARPU_MPI_FXT_H__ 45 | -------------------------------------------------------------------------------- /mpi/tests/ring_kernel.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | static __global__ void cuda_incrementer(unsigned *token) 20 | { 21 | (*token)++; 22 | } 23 | 24 | extern "C" void increment_cuda(void *descr[], void *_args) 25 | { 26 | (void) _args; 27 | unsigned *tokenptr = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]); 28 | 29 | cuda_incrementer<<<1,1>>>(tokenptr); 30 | } 31 | -------------------------------------------------------------------------------- /src/common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef COMMON_H 18 | #define COMMON_H 19 | 20 | #ifdef UNUSED 21 | #elif defined(__GNUC__) 22 | #define UNUSED(x) UNUSED_ ## x __attribute__((unused)) 23 | #else 24 | #define UNUSED(x) x 25 | #endif 26 | 27 | typedef struct starpu_driver_t *starpu_driver; 28 | typedef struct starpu_buffer_t * starpu_buffer; 29 | typedef struct starpu_memory_node_t * starpu_memory_node; 30 | 31 | #endif //COMMON_H 32 | -------------------------------------------------------------------------------- /src/common/hash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #define CRC32C_POLY_BE 0x1EDC6F41 22 | 23 | static inline uint32_t __attribute__ ((pure)) crc32_be_8(uint8_t inputbyte, uint32_t inputcrc) 24 | { 25 | unsigned i; 26 | uint32_t crc; 27 | 28 | crc = inputcrc ^ (inputbyte << 24); 29 | for (i = 0; i < 8; i++) 30 | crc = (crc << 1) ^ ((crc & 0x80000000) ? CRC32C_POLY_BE : 0); 31 | 32 | return crc; 33 | } 34 | 35 | uint32_t _starpu_crc32_be(uint32_t input, uint32_t inputcrc) 36 | { 37 | uint8_t *p = (uint8_t *)&input; 38 | 39 | uint32_t crc = inputcrc; 40 | 41 | crc = crc32_be_8(p[0], crc); 42 | crc = crc32_be_8(p[1], crc); 43 | crc = crc32_be_8(p[2], crc); 44 | crc = crc32_be_8(p[3], crc); 45 | 46 | return crc; 47 | } 48 | 49 | uint32_t _starpu_crc32_string(char *str, uint32_t inputcrc) 50 | { 51 | uint32_t hash = inputcrc; 52 | 53 | size_t len = strlen(str); 54 | 55 | unsigned i; 56 | for (i = 0; i < len; i++) 57 | { 58 | hash = crc32_be_8((uint8_t)str[i], hash); 59 | } 60 | 61 | return hash; 62 | } 63 | -------------------------------------------------------------------------------- /src/common/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __HASH_H__ 18 | #define __HASH_H__ 19 | 20 | #include 21 | 22 | uint32_t _starpu_crc32_be(uint32_t input, uint32_t inputcrc); 23 | uint32_t _starpu_crc32_string(char *str, uint32_t inputcrc); 24 | 25 | #endif // __HASH_H__ 26 | -------------------------------------------------------------------------------- /src/common/htable32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __GENERIC_HTABLE_H__ 18 | #define __GENERIC_HTABLE_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #define STARPU_HTBL32_NODE_SIZE 16 26 | 27 | typedef struct starpu_htbl32_node_s { 28 | unsigned nentries; 29 | struct starpu_htbl32_node_s *children[1< 21 | #include 22 | 23 | typedef struct starpu_rw_lock_s { 24 | uint32_t busy; 25 | uint8_t writer; 26 | uint16_t readercnt; 27 | } starpu_rw_lock_t; 28 | 29 | void _starpu_init_rw_lock(starpu_rw_lock_t *lock); 30 | void _starpu_take_rw_lock_write(starpu_rw_lock_t *lock); 31 | void _starpu_take_rw_lock_read(starpu_rw_lock_t *lock); 32 | int _starpu_take_rw_lock_write_try(starpu_rw_lock_t *lock); 33 | int _starpu_take_rw_lock_read_try(starpu_rw_lock_t *lock); 34 | void _starpu_release_rw_lock(starpu_rw_lock_t *lock); 35 | 36 | ///* make sure to have the lock before using that function */ 37 | //inline uint8_t _starpu_rw_lock_is_writer(starpu_rw_lock_t *lock); 38 | //unsigned _starpu_is_rw_lock_referenced(starpu_rw_lock_t *lock); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/common/starpu_spinlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | #ifndef __STARPU_SPINLOCK_H__ 17 | #define __STARPU_SPINLOCK_H__ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | typedef struct starpu_spinlock_s { 25 | #ifdef HAVE_PTHREAD_SPIN_LOCK 26 | pthread_spinlock_t lock; 27 | #else 28 | /* we only have a trivial implementation yet ! */ 29 | uint32_t taken __attribute__ ((aligned(16))); 30 | #endif 31 | } starpu_spinlock_t; 32 | 33 | int _starpu_spin_init(starpu_spinlock_t *lock); 34 | int _starpu_spin_destroy(starpu_spinlock_t *lock); 35 | 36 | int _starpu_spin_lock(starpu_spinlock_t *lock); 37 | int _starpu_spin_trylock(starpu_spinlock_t *lock); 38 | int _starpu_spin_unlock(starpu_spinlock_t *lock); 39 | 40 | #endif // __STARPU_SPINLOCK_H__ 41 | -------------------------------------------------------------------------------- /src/common/timing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef TIMING_H 18 | #define TIMING_H 19 | 20 | /* 21 | * _starpu_timing_init must be called prior to using any of these timing 22 | * functions. 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | void _starpu_timing_init(void); 32 | void starpu_clock_gettime(struct timespec *ts); 33 | double _starpu_timing_now(void); 34 | 35 | #endif /* TIMING_H */ 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/core/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DEBUG_H__ 18 | #define __DEBUG_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | void _starpu_open_debug_logfile(void); 28 | void _starpu_close_debug_logfile(void); 29 | 30 | void _starpu_print_to_logfile(const char *format, ...); 31 | 32 | #endif // __DEBUG_H__ 33 | -------------------------------------------------------------------------------- /src/core/dependencies/data_concurrency.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DATA_CONCURRENCY_H__ 18 | #define __DATA_CONCURRENCY_H__ 19 | 20 | #include 21 | 22 | unsigned _starpu_submit_job_enforce_data_deps(starpu_job_t j); 23 | 24 | void _starpu_notify_data_dependencies(starpu_data_handle handle); 25 | 26 | unsigned _starpu_attempt_to_submit_data_request_from_apps(starpu_data_handle handle, 27 | starpu_access_mode mode, 28 | void (*callback)(void *), void *argcb); 29 | 30 | #endif // __DATA_CONCURRENCY_H__ 31 | 32 | -------------------------------------------------------------------------------- /src/core/dependencies/implicit_data_deps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __IMPLICIT_DATA_DEPS_H__ 18 | #define __IMPLICIT_DATA_DEPS_H__ 19 | 20 | #include 21 | #include 22 | 23 | void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_task, struct starpu_task *post_sync_task, 24 | starpu_data_handle handle, starpu_access_mode mode); 25 | void _starpu_detect_implicit_data_deps(struct starpu_task *task); 26 | void _starpu_release_data_enforce_sequential_consistency(struct starpu_task *task, starpu_data_handle handle); 27 | 28 | void _starpu_add_post_sync_tasks(struct starpu_task *post_sync_task, starpu_data_handle handle); 29 | void _starpu_unlock_post_sync_tasks(starpu_data_handle handle); 30 | 31 | /* This function blocks until the handle is available in the requested mode */ 32 | int _starpu_data_wait_until_available(starpu_data_handle handle, starpu_access_mode mode); 33 | 34 | #endif // __IMPLICIT_DATA_DEPS_H__ 35 | 36 | -------------------------------------------------------------------------------- /src/core/dependencies/task_deps.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /* task depends on given events */ 23 | void starpu_task_declare_deps_array(struct starpu_task *task, unsigned num_events, starpu_event *events) 24 | { 25 | if (num_events == 0) 26 | return; 27 | 28 | starpu_job_t job; 29 | 30 | job = _starpu_get_job_associated_to_task(task); 31 | 32 | //STARPU_TRACE_TASK_DEPS(dep_job, job); 33 | _starpu_trigger_events_register(&job->trigger, num_events, events); 34 | } 35 | -------------------------------------------------------------------------------- /src/core/errorcheck.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | void _starpu_set_local_worker_status(starpu_worker_status st) 21 | { 22 | struct starpu_worker_s *worker = _starpu_get_local_worker_key(); 23 | 24 | /* It is possible that we call this function from the application (and 25 | * thereforce outside a worker), for instance if we are executing the 26 | * callback function of a task with a "NULL" codelet. */ 27 | if (worker) 28 | worker->status = st; 29 | } 30 | 31 | starpu_worker_status _starpu_get_local_worker_status(void) 32 | { 33 | struct starpu_worker_s *worker = _starpu_get_local_worker_key(); 34 | if (STARPU_UNLIKELY(!worker)) 35 | return STATUS_INVALID; 36 | 37 | return worker->status; 38 | } 39 | 40 | /* It is forbidden to call blocking operations with Callback and during the 41 | * execution of a task. */ 42 | unsigned _starpu_worker_may_perform_blocking_calls(void) 43 | { 44 | starpu_worker_status st = _starpu_get_local_worker_status(); 45 | 46 | return ( !(st == STATUS_CALLBACK) && !(st == STATUS_EXECUTING)); 47 | } 48 | -------------------------------------------------------------------------------- /src/core/errorcheck.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __ERRORCHECK_H__ 18 | #define __ERRORCHECK_H__ 19 | 20 | #include 21 | 22 | typedef enum { 23 | /* invalid status (for instance if we request the status of some thread 24 | * that is not controlled by StarPU */ 25 | STATUS_INVALID, 26 | /* everything that does not fit the other status */ 27 | STATUS_UNKNOWN, 28 | /* during the initialization */ 29 | STATUS_INITIALIZING, 30 | /* during the execution of a codelet */ 31 | STATUS_EXECUTING, 32 | /* during the execution of the callback */ 33 | STATUS_CALLBACK, 34 | /* while sleeping because there is nothing to do */ 35 | STATUS_SLEEPING 36 | } starpu_worker_status; 37 | 38 | void _starpu_set_local_worker_status(starpu_worker_status st); 39 | starpu_worker_status _starpu_get_local_worker_status(void); 40 | 41 | unsigned _starpu_worker_may_perform_blocking_calls(void); 42 | 43 | #endif // __ERRORCHECK_H__ 44 | -------------------------------------------------------------------------------- /src/core/event_group.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | starpu_event starpu_event_group_create(int num_events, starpu_event *events) { 21 | starpu_event event; 22 | 23 | starpu_trigger trigger = _starpu_trigger_create(NULL, NULL, &event); 24 | /* We switch from private event retaining to public retaining */ 25 | if (event != NULL) { 26 | starpu_event_retain(event); 27 | _starpu_event_release_private(event); 28 | } 29 | 30 | _starpu_trigger_events_register(trigger, num_events, events); 31 | 32 | _starpu_trigger_enable(trigger); 33 | 34 | return event; 35 | } 36 | -------------------------------------------------------------------------------- /src/core/perfmodel/regression.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __REGRESSION_H__ 18 | #define __REGRESSION_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | int _starpu_regression_non_linear_power(struct starpu_history_list_t *ptr, double *a, double *b, double *c); 27 | 28 | #endif // __REGRESSION_H__ 29 | -------------------------------------------------------------------------------- /src/core/priorities.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /* By default we have a binary type of priority: either a task is a priority 22 | * task (level 1) or it is not (level 0). */ 23 | static int sched_min_prio = 0; 24 | static int sched_max_prio = 1; 25 | 26 | /* The scheduling policy may set its own priority bounds in case it supports 27 | * different priority levels. These methods should only be called from the 28 | * scheduling policy. */ 29 | void starpu_sched_set_min_priority(int min_prio) 30 | { 31 | sched_min_prio = min_prio; 32 | } 33 | 34 | void starpu_sched_set_max_priority(int max_prio) 35 | { 36 | sched_max_prio = max_prio; 37 | } 38 | 39 | /* Returns the minimum priority level supported by the scheduling policy. */ 40 | int starpu_sched_get_min_priority(void) 41 | { 42 | return sched_min_prio; 43 | } 44 | 45 | /* Returns the maximum priority level supported by the scheduling policy. */ 46 | int starpu_sched_get_max_priority(void) 47 | { 48 | return sched_max_prio; 49 | } 50 | -------------------------------------------------------------------------------- /src/core/sched_policy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __SCHED_POLICY_H__ 18 | #define __SCHED_POLICY_H__ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | struct starpu_machine_config_s; 26 | struct starpu_sched_policy_s *_starpu_get_sched_policy(void); 27 | 28 | void _starpu_init_sched_policy(struct starpu_machine_config_s *config); 29 | void _starpu_deinit_sched_policy(struct starpu_machine_config_s *config); 30 | 31 | int _starpu_get_prefetch_flag(void); 32 | 33 | int _starpu_push_task(starpu_job_t task, unsigned job_is_already_locked); 34 | struct starpu_task *_starpu_pop_task(void); 35 | struct starpu_task *_starpu_pop_every_task(uint32_t where); 36 | void _starpu_sched_post_exec_hook(struct starpu_task *task); 37 | 38 | void _starpu_wait_on_sched_event(void); 39 | 40 | #endif // __SCHED_POLICY_H__ 41 | -------------------------------------------------------------------------------- /src/core/task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __CORE_TASK_H__ 18 | #define __CORE_TASK_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /* In order to implement starpu_task_wait_for_all, we keep track of the number of 25 | * task currently submitted */ 26 | void _starpu_decrement_nsubmitted_tasks(void); 27 | 28 | void _starpu_initialize_current_task_key(void); 29 | void _starpu_set_current_task(struct starpu_task *task); 30 | 31 | /* NB the second argument makes it possible to count regenerable tasks only 32 | * once. */ 33 | int _starpu_submit_job(starpu_job_t j, unsigned do_not_increment_nsubmitted); 34 | starpu_job_t _starpu_get_job_associated_to_task(struct starpu_task *task); 35 | 36 | #endif // __CORE_TASK_H__ 37 | -------------------------------------------------------------------------------- /src/core/topology.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __TOPOLOGY_H__ 18 | #define __TOPOLOGY_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /* TODO actually move this struct into this header */ 26 | struct starpu_machine_config_s; 27 | 28 | int _starpu_build_topology(struct starpu_machine_config_s *config); 29 | 30 | void _starpu_destroy_topology(struct starpu_machine_config_s *config); 31 | 32 | /* returns the number of physical cpus */ 33 | unsigned _starpu_topology_get_nhwcpu(struct starpu_machine_config_s *config); 34 | 35 | void _starpu_bind_thread_on_cpu(struct starpu_machine_config_s *config, unsigned cpuid); 36 | 37 | #endif // __TOPOLOGY_H__ 38 | -------------------------------------------------------------------------------- /src/core/trigger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __TRIGGER_H__ 18 | #define __TRIGGER_H__ 19 | 20 | #include 21 | 22 | typedef struct starpu_trigger_t * starpu_trigger; 23 | 24 | struct starpu_trigger_t { 25 | void * data; 26 | void (*callback)(void*); 27 | int dep_count; 28 | 29 | int enabled; 30 | int allocated; 31 | starpu_event event; 32 | }; 33 | 34 | starpu_trigger _starpu_trigger_create(void (*callback)(void*), void*data, starpu_event *event); 35 | 36 | void _starpu_trigger_init(starpu_trigger trigger, void (*callback)(void*), void *data, starpu_event *event); 37 | 38 | void _starpu_trigger_events_register(starpu_trigger, int num_events, starpu_event *events); 39 | 40 | void _starpu_trigger_enable(starpu_trigger trigger); 41 | 42 | void _starpu_trigger_signal(starpu_trigger trigger); 43 | 44 | int starpu_event_bind(starpu_event source, starpu_event dest); 45 | 46 | #endif // __TRIGGER_H__ 47 | -------------------------------------------------------------------------------- /src/datawizard/datastats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DATASTATS_H__ 18 | #define __DATASTATS_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | void _starpu_msi_cache_hit(unsigned node); 26 | void _starpu_msi_cache_miss(unsigned node); 27 | 28 | void _starpu_display_msi_stats(void); 29 | 30 | void _starpu_allocation_cache_hit(unsigned node __attribute__ ((unused))); 31 | void _starpu_data_allocation_inc_stats(unsigned node __attribute__ ((unused))); 32 | 33 | 34 | void _starpu_display_comm_amounts(void); 35 | void _starpu_display_alloc_cache_stats(void); 36 | 37 | #endif // __DATASTATS_H__ 38 | -------------------------------------------------------------------------------- /src/datawizard/datawizard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DATAWIZARD_H__ 18 | #define __DATAWIZARD_H__ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | void _starpu_datawizard_progress(uint32_t memory_node, unsigned may_alloc); 36 | 37 | #endif // __DATAWIZARD_H__ 38 | -------------------------------------------------------------------------------- /src/datawizard/filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __FILTERS_H__ 18 | #define __FILTERS_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/datawizard/footprint.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | void _starpu_compute_buffers_footprint(starpu_job_t j) 21 | { 22 | uint32_t footprint = 0; 23 | unsigned buffer; 24 | 25 | struct starpu_task *task = j->task; 26 | 27 | for (buffer = 0; buffer < task->cl->nbuffers; buffer++) 28 | { 29 | starpu_data_handle handle = task->buffers[buffer].handle; 30 | 31 | uint32_t handle_footprint = _starpu_data_get_footprint(handle); 32 | 33 | footprint = _starpu_crc32_be(handle_footprint, footprint); 34 | } 35 | 36 | j->footprint = footprint; 37 | j->footprint_is_computed = 1; 38 | } 39 | 40 | inline uint32_t _starpu_compute_data_footprint(starpu_data_handle handle) 41 | { 42 | uint32_t interfaceid = (uint32_t)starpu_get_handle_interface_id(handle); 43 | 44 | uint32_t handle_footprint = handle->ops->footprint(handle); 45 | 46 | return _starpu_crc32_be(handle_footprint, interfaceid); 47 | } 48 | -------------------------------------------------------------------------------- /src/datawizard/footprint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __FOOTPRINT_H__ 18 | #define __FOOTPRINT_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | void _starpu_compute_buffers_footprint(struct starpu_job_s *j); 25 | uint32_t _starpu_compute_data_footprint(starpu_data_handle handle); 26 | 27 | #endif // __FOOTPRINT_H__ 28 | -------------------------------------------------------------------------------- /src/datawizard/interfaces/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # StarPU 3 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; either version 2.1 of the License, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # 14 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | # 16 | 17 | OBJS := bcsr_interface.o csr_interface.o blas_filters.o blas_interface.o vector_interface.o bcsr_filters.o csr_filters.o vector_filters.o 18 | 19 | all: $(OBJS) 20 | 21 | ifeq ($(filter ${MAKECMDGOALS},clean distclean),) 22 | %.d: %.c 23 | $(CC) $(CFLAGS) $< -MM -o $*.d 24 | 25 | -include $(OBJS:.o=.d) 26 | endif 27 | 28 | clean: 29 | @rm -f *.o *.d *.gcno *.gcda 30 | -------------------------------------------------------------------------------- /src/datawizard/interfaces/bcsr_filters.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | void starpu_canonical_block_filter_bcsr(void *father_interface, void *child_interface, __attribute__((unused)) struct starpu_data_filter *f, unsigned id, __attribute__((unused)) unsigned nparts) 22 | { 23 | struct starpu_bcsr_interface_s *bcsr_father = father_interface; 24 | /* each chunk becomes a small dense matrix */ 25 | starpu_matrix_interface_t *matrix_child = child_interface; 26 | 27 | size_t elemsize = bcsr_father->elemsize; 28 | uint32_t firstentry = bcsr_father->firstentry; 29 | 30 | /* size of the tiles */ 31 | uint32_t r = bcsr_father->r; 32 | uint32_t c = bcsr_father->c; 33 | 34 | uint32_t ptr_offset = c*r*id*elemsize; 35 | 36 | matrix_child->nx = c; 37 | matrix_child->ny = r; 38 | matrix_child->ld = c; 39 | matrix_child->elemsize = elemsize; 40 | 41 | if (bcsr_father->nzval) { 42 | uint8_t *nzval = (uint8_t *)(bcsr_father->nzval); 43 | matrix_child->ptr = (uintptr_t)&nzval[firstentry + ptr_offset]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/datawizard/interfaces/data_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DATA_INTERFACE_H__ 18 | #define __DATA_INTERFACE_H__ 19 | 20 | #include 21 | #include 22 | 23 | /* Some data interfaces or filters use this interface internally */ 24 | extern struct starpu_data_interface_ops_t _starpu_interface_matrix_ops; 25 | void _starpu_data_free_interfaces(starpu_data_handle handle); 26 | 27 | #endif // __DATA_INTERFACE_H__ 28 | -------------------------------------------------------------------------------- /src/datawizard/progress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | void _starpu_datawizard_progress(uint32_t memory_node, unsigned may_alloc) 23 | { 24 | /* in case some other driver requested data */ 25 | _starpu_handle_pending_node_data_requests(memory_node); 26 | _starpu_handle_node_data_requests(memory_node, may_alloc); 27 | 28 | _starpu_execute_registered_progression_hooks(); 29 | } 30 | -------------------------------------------------------------------------------- /src/datawizard/sort_data_handles.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __SORT_DATA_HANDLES_H__ 18 | #define __SORT_DATA_HANDLES_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | void _starpu_sort_task_handles(starpu_buffer_descr descr[], unsigned nbuffers); 29 | 30 | #endif // SORT_DATA_HANDLES 31 | -------------------------------------------------------------------------------- /src/datawizard/write_back.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DW_WRITE_BACK_H__ 18 | #define __DW_WRITE_BACK_H__ 19 | 20 | #include 21 | #include 22 | 23 | void _starpu_write_through_data(starpu_data_handle handle, uint32_t requesting_node, 24 | uint32_t write_through_mask); 25 | 26 | #endif // __DW_WRITE_BACK_H__ 27 | -------------------------------------------------------------------------------- /src/debug/latency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | void _starpu_benchmark_ping_pong(starpu_data_handle handle, 22 | unsigned node0, unsigned node1, unsigned niter) 23 | { 24 | /* We assume that no one is using that handle !! */ 25 | unsigned iter; 26 | for (iter = 0; iter < niter; iter++) 27 | { 28 | int ret; 29 | ret = _starpu_fetch_data_on_node(handle, node0, STARPU_RW, 0, NULL, NULL); 30 | STARPU_ASSERT(!ret); 31 | ret = _starpu_fetch_data_on_node(handle, node1, STARPU_RW, 0, NULL, NULL); 32 | STARPU_ASSERT(!ret); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/dolib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010 Université Bordeaux 1 3 | * See COPYING in top-level directory. 4 | */ 5 | 6 | /* Wrapper to avoid msys' tendency to turn / into \ and : into ; */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | int main(int argc, char *argv[]) { 13 | char *prog, *arch, *def, *name, *lib; 14 | char s[1024]; 15 | 16 | if (argc != 6) { 17 | fprintf(stderr,"bad number of arguments"); 18 | exit(EXIT_FAILURE); 19 | } 20 | 21 | prog = argv[1]; 22 | arch = argv[2]; 23 | def = argv[3]; 24 | name = argv[4]; 25 | lib = argv[5]; 26 | 27 | snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s", 28 | prog, arch, def, name, lib); 29 | if (system(s)) { 30 | fprintf(stderr, "%s failed\n", s); 31 | exit(EXIT_FAILURE); 32 | } 33 | 34 | exit(EXIT_SUCCESS); 35 | } 36 | -------------------------------------------------------------------------------- /src/drivers/common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_COMMON_H__ 18 | #define __DRIVER_COMMON_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | void _starpu_driver_update_job_feedback(starpu_job_t j, struct starpu_worker_s *worker_args, 28 | unsigned calibrate_model, 29 | struct timespec *codelet_start, struct timespec *codelet_end); 30 | 31 | void _starpu_block_worker(int workerid, pthread_cond_t *cond, pthread_mutex_t *mutex); 32 | 33 | #endif // __DRIVER_COMMON_H__ 34 | -------------------------------------------------------------------------------- /src/drivers/cpu/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_CPU_H__ 18 | #define __DRIVER_CPU_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | void *_starpu_cpu_worker(void *); 31 | 32 | #endif // __DRIVER_CPU_H__ 33 | -------------------------------------------------------------------------------- /src/drivers/cuda/cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_CUDA_H__ 18 | #define __DRIVER_CUDA_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef STARPU_USE_CUDA 25 | #include 26 | #include 27 | #include 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | unsigned _starpu_get_cuda_device_count(void); 41 | 42 | #ifdef STARPU_USE_CUDA 43 | void _starpu_init_cuda(void); 44 | void *_starpu_cuda_worker(void *); 45 | #endif 46 | 47 | #endif // __DRIVER_CUDA_H__ 48 | 49 | -------------------------------------------------------------------------------- /src/drivers/cuda/event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifdef STARPU_USE_CUDA 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | struct arg_t { 24 | cudaEvent_t cuda_event; 25 | starpu_event event; 26 | }; 27 | 28 | static void * cuda_event_thread(void *args) { 29 | struct arg_t *arg = (struct arg_t*)args; 30 | 31 | cudaError_t err = cudaEventSynchronize(arg->cuda_event); 32 | 33 | if (STARPU_UNLIKELY(err)) 34 | STARPU_CUDA_REPORT_ERROR(err); 35 | 36 | _starpu_event_complete(arg->event); 37 | 38 | err = cudaEventDestroy(arg->cuda_event); 39 | 40 | if (STARPU_UNLIKELY(err)) 41 | STARPU_CUDA_REPORT_ERROR(err); 42 | 43 | free(arg); 44 | } 45 | 46 | starpu_event _starpu_cuda_event_create(cudaEvent_t event) { 47 | struct arg_t * arg = malloc(sizeof(struct arg_t)); 48 | 49 | arg->event = _starpu_event_create(); 50 | arg->cuda_event = event; 51 | 52 | pthread_t thread; 53 | pthread_create(&thread, NULL, cuda_event_thread, arg); 54 | pthread_detach(thread); 55 | 56 | return arg->event; 57 | } 58 | 59 | #endif // STARPU_USE_CUDA 60 | -------------------------------------------------------------------------------- /src/drivers/cuda/event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_CUDA_EVENT_H__ 18 | #define __DRIVER_CUDA_EVENT_H__ 19 | 20 | #ifdef STARPU_USE_CUDA 21 | 22 | #include 23 | 24 | starpu_event _starpu_cuda_event_create(cudaEvent_t); 25 | 26 | #endif // __DRIVER_CUDA_EVENT_H__ 27 | -------------------------------------------------------------------------------- /src/drivers/gordon/.externals: -------------------------------------------------------------------------------- 1 | scalp https://gforge.cs.vu.nl/svn/scalp/branches/gonnet/ 2 | -------------------------------------------------------------------------------- /src/drivers/gordon/gordon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_GORDON_H__ 18 | #define __DRIVER_GORDON_H__ 19 | 20 | #ifndef _GNU_SOURCE 21 | #define _GNU_SOURCE 22 | #endif 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | #define NMAXGORDONSPUS 8 41 | 42 | void *_starpu_gordon_worker(void *); 43 | 44 | #endif // __DRIVER_GORDON_H__ 45 | -------------------------------------------------------------------------------- /src/drivers/gordon/gordon_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __GORDON_INTERFACE_H__ 18 | #define __GORDON_INTERFACE_H__ 19 | 20 | //#include 21 | #include 22 | 23 | #endif // __GORDON_INTERFACE_H__ 24 | -------------------------------------------------------------------------------- /src/drivers/opencl/event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __DRIVER_OPENCL_EVENT_H__ 18 | #define __DRIVER_OPENCL_EVENT_H__ 19 | 20 | #ifndef _GNU_SOURCE 21 | #define _GNU_SOURCE 22 | #endif 23 | 24 | #include 25 | 26 | void _starpu_opencl_events_init(); 27 | starpu_event _starpu_opencl_event_create(cl_event); 28 | int _starpu_opencl_event_bind(cl_event clevent, starpu_event event); 29 | 30 | #endif // __DRIVER_OPENCL_EVENT_H__ 31 | -------------------------------------------------------------------------------- /src/drivers/opencl/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __STARPU_OPENCL_UTILS_H__ 18 | #define __STARPU_OPENCL_UTILS_H__ 19 | 20 | #include 21 | 22 | #define STARPU_OPENCL_PLATFORM_MAX 4 23 | 24 | #endif /* __STARPU_OPENCL_UTILS_H__ */ 25 | -------------------------------------------------------------------------------- /src/profiling/bound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __BOUND_H__ 18 | #define __BOUND_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /* Record task for bound computation */ 25 | extern void _starpu_bound_record(starpu_job_t j); 26 | 27 | #endif // __BOUND_H__ 28 | -------------------------------------------------------------------------------- /src/profiling/profiling.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __PROFILING_H__ 18 | #define __PROFILING_H__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | int starpu_profiling_enabled(); 26 | 27 | void _starpu_worker_reset_profiling_info(int workerid); 28 | void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks); 29 | void _starpu_worker_update_profiling_info_sleeping(int workerid, struct timespec *sleeping_start, struct timespec *sleeping_end); 30 | void _starpu_worker_register_sleeping_start_date(int workerid, struct timespec *sleeping_start); 31 | void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start); 32 | 33 | void _starpu_initialize_busid_matrix(void); 34 | int _starpu_register_bus(int src_node, int dst_node); 35 | void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size); 36 | 37 | #endif // __PROFILING_H__ 38 | -------------------------------------------------------------------------------- /src/util/file.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | void _starpu_drop_comments(FILE *f) 20 | { 21 | while(1) { 22 | int c = getc(f); 23 | 24 | switch (c) { 25 | case '#': 26 | { 27 | char s[128]; 28 | do { 29 | fgets(s, sizeof(s), f); 30 | } while (!strchr(s, '\n')); 31 | } 32 | case '\n': 33 | continue; 34 | default: 35 | ungetc(c, f); 36 | return; 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/util/starpu_cublas.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef STARPU_USE_CUDA 22 | static void init_cublas_func(void *args __attribute__((unused))) 23 | { 24 | cublasStatus cublasst = cublasInit(); 25 | if (STARPU_UNLIKELY(cublasst)) 26 | STARPU_CUBLAS_REPORT_ERROR(cublasst); 27 | } 28 | 29 | static void shutdown_cublas_func(void *args __attribute__((unused))) 30 | { 31 | cublasShutdown(); 32 | } 33 | #endif 34 | 35 | void starpu_helper_cublas_init(void) 36 | { 37 | #ifdef STARPU_USE_CUDA 38 | starpu_execute_on_each_worker(init_cublas_func, NULL, STARPU_CUDA); 39 | #endif 40 | } 41 | 42 | void starpu_helper_cublas_shutdown(void) 43 | { 44 | #ifdef STARPU_USE_CUDA 45 | starpu_execute_on_each_worker(shutdown_cublas_func, NULL, STARPU_CUDA); 46 | #endif 47 | } 48 | -------------------------------------------------------------------------------- /tests/cholesky/sched.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | maxiter=10 21 | MAXCPU=3 22 | 23 | trace_sched() 24 | { 25 | for blocks in `seq 10 2 24` 26 | do 27 | size=$(($blocks*1024)) 28 | 29 | echo "size : $size" 30 | 31 | OPTIONS="-pin -nblocks $blocks -size $size" 32 | 33 | cd $ROOTDIR 34 | filename=$TIMINGDIR/sched.$STARPU_SCHED.$size 35 | 36 | for iter in `seq 1 $maxiter` 37 | do 38 | echo "$iter / $maxiter" 39 | echo "$ROOTDIR/examples/cholesky/dw_cholesky $OPTIONS 2> /dev/null" 40 | val=`$ROOTDIR/examples/cholesky/dw_cholesky $OPTIONS 2> /dev/null` 41 | echo "$val" >> $filename 42 | done 43 | done 44 | } 45 | 46 | DIR=$PWD 47 | ROOTDIR=$DIR/../.. 48 | TIMINGDIR=$DIR/timings-sched/ 49 | mkdir -p $TIMINGDIR 50 | 51 | schedlist="greedy no-prio dm random" 52 | #schedlist="random" 53 | 54 | for sched in $schedlist 55 | do 56 | export STARPU_SCHED=$sched 57 | echo "sched : $STARPU_SCHED" 58 | 59 | trace_sched; 60 | done 61 | -------------------------------------------------------------------------------- /tests/core/empty_task_chain.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | #define N 4 20 | 21 | int main(int argc, char **argv) 22 | { 23 | int i, ret; 24 | 25 | starpu_init(NULL); 26 | 27 | starpu_event user_event, event; 28 | user_event = starpu_event_create(); 29 | starpu_event_retain(user_event); 30 | event = user_event; 31 | 32 | for (i = 0; i < N; i++) 33 | { 34 | struct starpu_task * task; 35 | task = starpu_task_create(); 36 | task->cl = NULL; 37 | 38 | starpu_task_declare_deps_array(task, 1, &event); 39 | starpu_event_release(event); 40 | 41 | ret = starpu_task_submit(task, &event); 42 | STARPU_ASSERT(!ret); 43 | } 44 | 45 | starpu_event_trigger(user_event); 46 | 47 | starpu_event_wait(user_event); 48 | starpu_event_release(user_event); 49 | 50 | starpu_shutdown(); 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /tests/core/event_callback.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | void callback(void*); 21 | 22 | int main() { 23 | 24 | starpu_event event; 25 | int val = 0; 26 | unsigned count = 10; 27 | 28 | starpu_init(NULL); 29 | 30 | event = starpu_event_create(); 31 | 32 | starpu_event_callback_add(event, &callback, &val, NULL); 33 | 34 | starpu_event_trigger(event); 35 | starpu_event_release(event); 36 | 37 | while ((volatile int)val != 999 && count != 0) { 38 | count -= 1; 39 | usleep(50); 40 | } 41 | 42 | starpu_shutdown(); 43 | 44 | return (val != 999 ? -1 : 0); 45 | } 46 | 47 | void callback(void*data) { 48 | int * val = (int*)data; 49 | *val = 999; 50 | } 51 | -------------------------------------------------------------------------------- /tests/core/restart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #define N 10 24 | 25 | struct timeval start; 26 | struct timeval end; 27 | 28 | int main(int argc, char **argv) 29 | { 30 | unsigned iter; 31 | 32 | double init_timing = 0.0; 33 | double shutdown_timing = 0.0; 34 | 35 | for (iter = 0; iter < N; iter++) 36 | { 37 | gettimeofday(&start, NULL); 38 | /* Initialize StarPU */ 39 | starpu_init(NULL); 40 | gettimeofday(&end, NULL); 41 | init_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec)); 42 | 43 | gettimeofday(&start, NULL); 44 | /* Shutdown StarPU */ 45 | starpu_shutdown(); 46 | gettimeofday(&end, NULL); 47 | shutdown_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec)); 48 | } 49 | 50 | fprintf(stderr, "starpu_init: %2.2f seconds\n", init_timing/(N*1000000)); 51 | fprintf(stderr, "starpu_shutdown: %2.2f seconds\n", shutdown_timing/(N*1000000)); 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /tests/datawizard/cuda_codelet_unsigned_inc.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | static __global__ void _cuda_unsigned_inc(unsigned *val) 20 | { 21 | val[0]++; 22 | } 23 | 24 | extern "C" void cuda_codelet_unsigned_inc(void *descr[], STARPU_ATTRIBUTE_UNUSED void *cl_arg) 25 | { 26 | unsigned *val = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]); 27 | 28 | _cuda_unsigned_inc<<<1,1>>>(val); 29 | 30 | cudaThreadSynchronize(); 31 | } 32 | -------------------------------------------------------------------------------- /tests/datawizard/scratch_cuda.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #define MAXNBLOCKS 32 21 | #define MAXTHREADSPERBLOCK 128 22 | 23 | static __global__ void increment_vector(unsigned *v, unsigned *tmp, int nx) 24 | { 25 | const int tid = threadIdx.x + blockIdx.x*blockDim.x; 26 | const int nthreads = gridDim.x * blockDim.x; 27 | 28 | int i; 29 | for (i = tid; i < nx; i += nthreads) 30 | { 31 | v[i] = tmp[i] + 1; 32 | } 33 | } 34 | 35 | extern "C" void cuda_f(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args) 36 | { 37 | unsigned *v = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]); 38 | unsigned *tmp = (unsigned *)STARPU_VECTOR_GET_PTR(descr[1]); 39 | 40 | unsigned nx = STARPU_VECTOR_GET_NX(descr[0]); 41 | size_t elemsize = STARPU_VECTOR_GET_ELEMSIZE(descr[0]); 42 | 43 | cudaMemcpy(tmp, v, nx*elemsize, cudaMemcpyDeviceToDevice); 44 | 45 | unsigned nblocks = 128; 46 | unsigned nthread_per_block = STARPU_MIN(MAXTHREADSPERBLOCK, (nx / nblocks)); 47 | 48 | increment_vector<<>>(v, tmp, nx); 49 | cudaThreadSynchronize(); 50 | } 51 | -------------------------------------------------------------------------------- /tests/datawizard/sync_and_notify_data_gordon_kernels.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | void incA (__attribute__ ((unused)) void **alloc, 18 | __attribute__ ((unused)) void **in, 19 | __attribute__ ((unused)) void **inout, 20 | __attribute__ ((unused)) void **out) 21 | { 22 | unsigned *v = inout[0]; 23 | v[0]++; 24 | } 25 | 26 | void incC (__attribute__ ((unused)) void **alloc, 27 | __attribute__ ((unused)) void **in, 28 | __attribute__ ((unused)) void **inout, 29 | __attribute__ ((unused)) void **out) 30 | { 31 | unsigned *v = inout[0]; 32 | v[2]++; 33 | } 34 | -------------------------------------------------------------------------------- /tests/datawizard/sync_and_notify_data_kernels.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | /* 20 | * increment a (val[0]) 21 | */ 22 | 23 | extern "C" __global__ void _cuda_incA(unsigned *v) 24 | { 25 | v[0]++; 26 | } 27 | 28 | extern "C" void cuda_codelet_incA(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args) 29 | { 30 | unsigned *v = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]); 31 | 32 | _cuda_incA<<<1,1>>>(v); 33 | 34 | cudaThreadSynchronize(); 35 | } 36 | 37 | /* 38 | * increment c (val[2]) 39 | */ 40 | 41 | extern "C" __global__ void _cuda_incC(unsigned *v) 42 | { 43 | v[2]++; 44 | } 45 | 46 | extern "C" void cuda_codelet_incC(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args) 47 | { 48 | unsigned *v = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]); 49 | 50 | _cuda_incC<<<1,1>>>(v); 51 | 52 | cudaThreadSynchronize(); 53 | } 54 | -------------------------------------------------------------------------------- /tests/datawizard/sync_and_notify_data_opencl_codelet.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | __kernel void incA(__global unsigned* input) 18 | { 19 | const int i = get_global_id(0); 20 | if (i == 0) 21 | input[i] ++; 22 | } 23 | 24 | __kernel void incC(__global unsigned* input) 25 | { 26 | const int i = get_global_id(0); 27 | if (i == 2) 28 | input[i] ++; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tests/errorcheck/starpu_init_noworker.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | int main(int argc, char **argv) 24 | { 25 | int ret; 26 | 27 | /* We try to initialize StarPU without any worker */ 28 | struct starpu_conf conf = { 29 | .sched_policy_name = NULL, /* default */ 30 | .ncpus = 0, 31 | .ncuda = 0, 32 | .nopencl = 0, 33 | .nspus = 0, 34 | .use_explicit_workers_bindid = 0, 35 | .use_explicit_workers_cuda_gpuid = 0, 36 | .use_explicit_workers_opencl_gpuid = 0, 37 | .calibrate = 0 38 | }; 39 | 40 | /* starpu_init should return -ENODEV */ 41 | ret = starpu_init(&conf); 42 | if (ret != -ENODEV) 43 | return -1; 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /tests/experiments/bandwidth_cuda/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # StarPU 3 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; either version 2.1 of the License, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # 14 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | # 16 | 17 | CUDASDKDIR=/home/gonnet/NVIDIA_CUDA_SDK/ 18 | CUDAINSTALLDIR=/usr/local/cuda/ 19 | 20 | CFLAGS += -I$(CUDAINSTALLDIR)/include -Wall 21 | LDFLAGS += -lcuda -L/usr/local/cuda/lib 22 | LDFLAGS += -lcublas -lpthread 23 | 24 | CFLAGS+= -I$(ATLASDIR)/include/ 25 | LDFLAGS+= $(ATLASDIR)/lib/$(BLASARCH)/libcblas.a 26 | LDFLAGS+= $(ATLASDIR)/lib/$(BLASARCH)/libatlas.a 27 | 28 | CFLAGS+= -g #-pg 29 | #LDFLAGS+= -pg 30 | 31 | all: cuda_bandwidth 32 | 33 | cuda_bandwidth: cuda_bandwidth.o 34 | $(CC) cuda_bandwidth.o -o cuda_bandwidth $(LDFLAGS) 35 | 36 | clean: 37 | rm -f cuda_bandwidth 38 | rm -f *.o 39 | -------------------------------------------------------------------------------- /tests/experiments/bandwidth_cuda/bench_bandwidth.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "bench_bandwidth.eps" 22 | set title "CUDA Bandwidth" 23 | set logscale x 24 | set xlabel "Size (Bytes)" 25 | set ylabel "Bandwidth (MB/s)" 26 | 27 | plot ".results/htod-pin.data" with linespoint title "Host to Device (pinned)",\ 28 | ".results/dtoh-pin.data" with linespoint title "Device to Host (pinned)" 29 | 30 | -------------------------------------------------------------------------------- /tests/experiments/latency/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # StarPU 3 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; either version 2.1 of the License, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # 14 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | # 16 | 17 | CUDASDKDIR?=/home/gonnet/NVIDIA_CUDA_SDK/ 18 | CUDAINSTALLDIR=/usr/local/cuda/ 19 | 20 | CFLAGS += -I$(CUDAINSTALLDIR)/include -Wall 21 | LDFLAGS += -lcuda -L/usr/local/cuda/lib64/ -lcudart 22 | LDFLAGS += -lpthread 23 | 24 | CFLAGS+= -g #-pg 25 | #LDFLAGS+= -pg 26 | 27 | all: cuda_latency 28 | 29 | cuda_latency: cuda_latency.c 30 | 31 | clean: 32 | rm -f cuda_latency 33 | rm -f *.o 34 | -------------------------------------------------------------------------------- /tests/heat/deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | maxiter=5 21 | MAXCPU=3 22 | 23 | trace_deps() 24 | { 25 | for blocks in `seq 2 2 10` 26 | do 27 | ntheta=$(( $(($blocks*32)) + 2)) 28 | size=$(( $(($blocks*32)) * 32)) 29 | 30 | echo "size : $size" 31 | 32 | OPTIONS="-pin -nblocks $blocks -ntheta $ntheta -nthick 34 -v$DEPS" 33 | 34 | cd $ROOTDIR 35 | filename=$TIMINGDIR/deps.v$DEPS.$size 36 | #rm -f $filename 37 | make clean 1> /dev/null 2> /dev/null 38 | make examples -j STARPU_ATLAS=1 CPUS=$MAXCPU CUDA=1 1> /dev/null 2> /dev/null 39 | cd $DIR 40 | 41 | for iter in `seq 1 $maxiter` 42 | do 43 | echo "$iter / $maxiter" 44 | val=`$ROOTDIR/examples/heat/heat $OPTIONS 2> /dev/null` 45 | echo "$val" >> $filename 46 | done 47 | done 48 | } 49 | 50 | DIR=$PWD 51 | ROOTDIR=$DIR/../.. 52 | TIMINGDIR=$DIR/timings-sched/ 53 | mkdir -p $TIMINGDIR 54 | 55 | for deps in 1 2 56 | do 57 | export DEPS=$deps 58 | echo "version : $DEPS" 59 | 60 | trace_deps; 61 | done 62 | -------------------------------------------------------------------------------- /tests/heat/gflops.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "gflops.eps" 22 | #set title "Facto LU : impact of granularity" 23 | set grid y 24 | set key box 25 | set xlabel "problem size (unknowns)" 26 | set ylabel "GFlop/s" 27 | set logscale x 28 | #set pointsize 2 29 | set key right bottom 30 | set datafile missing 'x' 31 | plot "timings/gflops.data" usi 1:(2*$1*$1*$1 / (3*$2* 1000000)) with linespoint lt 3 title "block size : 128" ,\ 32 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / (3*$3* 1000000)) with linespoint title "block size : 256" ,\ 33 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / (3*$4* 1000000)) with linespoint title "block size : 512" ,\ 34 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / (3*$5* 1000000)) with linespoint title "block size : 1024" 35 | -------------------------------------------------------------------------------- /tests/heat/speedup.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "speedup.eps" 22 | set title "Facto LU : impact of granularity" 23 | set xlabel "problem size (unknowns)" 24 | set ylabel "speedup ( 3 Cpus + 1 GPU vs . 4 Cpus )" 25 | set yrange [0.5:2.5] 26 | plot "speedup.8" usi 1:($3/$2) with lines title "(8x8)",\ 27 | "speedup.16" usi 1:($3/$2) with lines title "(16x16)",\ 28 | "speedup.32" usi 1:($3/$2) with lines title "(32x32)",\ 29 | "speedup.8" usi 1:((1)) with lines title "Reference" 30 | -------------------------------------------------------------------------------- /tests/heat/speedup.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | DIR=$PWD 20 | ROOTDIR=$DIR/../.. 21 | 22 | TIMINGDIR=$DIR/timings/ 23 | 24 | mkdir -p $TIMINGDIR 25 | cd $ROOTDIR 26 | 27 | make clean 1> /dev/null 2> /dev/null 28 | make STARPU_ATLAS=1 CPUS=16 1> /dev/null 2> /dev/null 29 | 30 | echo "speedup ..." 31 | 32 | for theta in 32 64 128 256 512 1024 33 | do 34 | size=$(($theta * 32)) 35 | 36 | echo "# ncpus time reftime" > $TIMINGDIR/speedup.$size 37 | 38 | for cpus in 1 2 4 6 8 10 12 14 16 39 | do 40 | export STARPU_NCPUS=$cpus 41 | 42 | echo "ncpus $cpus size $size" 43 | 44 | filename=$TIMINGDIR/timing.$cpus.$size 45 | $ROOTDIR/examples/heat -v2 -pin -nthick 34 -ntheta $(($theta+2)) -nblocks 16 2>/dev/null| tee $filename 46 | 47 | echo "$cpus `cat $TIMINGDIR/timing.$cpus.$size` `cat $TIMINGDIR/timing.1.$size`" >> $TIMINGDIR/speedup.$size 48 | done 49 | done 50 | -------------------------------------------------------------------------------- /tests/heat/speedup_barracuda.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "speedup.eps" 22 | set title "LU decomposition" 23 | set xlabel "number of CPUs" 24 | set ylabel "speedup" 25 | plot "timings/speedup.4096" usi 1:1 with lines title "ideal",\ 26 | "timings/speedup.4096" usi 1:($3/$2) with lines title "4096",\ 27 | "timings/speedup.8192" usi 1:($3/$2) with lines title "8192" 28 | -------------------------------------------------------------------------------- /tests/heat/speedup_hagrid.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "speedup.eps" 22 | set title "Matrix multiplication" 23 | set xlabel "number of CPUs" 24 | set ylabel "speedup" 25 | plot "timings/speedup.1024" usi 1:1 with lines title "ideal",\ 26 | "timings/speedup.1024" usi 1:($3/$2) with lines title "1024",\ 27 | "timings/speedup.2048" usi 1:($3/$2) with lines title "2048",\ 28 | "timings/speedup.4096" usi 1:($3/$2) with lines title "4096",\ 29 | "timings/speedup.8192" usi 1:($3/$2) with lines title "8192",\ 30 | "timings/speedup.16384" usi 1:($3/$2) with lines title "16384" 31 | -------------------------------------------------------------------------------- /tests/heat/time.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "time.eps" 22 | set title "Facto LU" 23 | set logscale y 24 | set xlabel "problem size (unknowns)" 25 | set ylabel "execution time (ms)" 26 | plot "time" usi 1:2 with lines title "0 cpu + 1 gpu",\ 27 | "time" usi 1:3 with lines title "4 cpus",\ 28 | "time" usi 1:4 with lines title "1 cpu + 1 gpu",\ 29 | "time" usi 1:5 with lines title "3 cpus + 1 gpu",\ 30 | "time" usi 1:6 with lines title "4 cpus + 1 gpu" 31 | -------------------------------------------------------------------------------- /tests/helper/execute_on_all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | void func(void *arg) 24 | { 25 | int *ptr = arg; 26 | STARPU_ASSERT(*ptr == 0x42); 27 | } 28 | 29 | int main(int argc, char **argv) 30 | { 31 | starpu_init(NULL); 32 | 33 | int arg = 0x42; 34 | 35 | starpu_execute_on_each_worker(func, &arg, STARPU_CPU|STARPU_CUDA|STARPU_OPENCL); 36 | 37 | starpu_execute_on_each_worker(func, &arg, STARPU_CPU); 38 | 39 | starpu_execute_on_each_worker(func, &arg, STARPU_CUDA); 40 | 41 | starpu_execute_on_each_worker(func, &arg, STARPU_OPENCL); 42 | 43 | starpu_shutdown(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /tests/helper/pinned_memory.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #define NITER 10 21 | #define SIZE (4*1024*1024*sizeof(float)) 22 | 23 | static float *data = NULL; 24 | 25 | int main(int argc, char **argv) 26 | { 27 | starpu_init(NULL); 28 | 29 | unsigned iter; 30 | for (iter = 0; iter < NITER; iter++) 31 | { 32 | starpu_data_malloc_pinned_if_possible((void **)&data, SIZE); 33 | starpu_data_free_pinned_if_possible(data); 34 | } 35 | 36 | starpu_shutdown(); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /tests/incrementer/speed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | # We compute the duration of the experiment for multiple powers of 2 20 | 21 | i=1 22 | 23 | examplebindir=../../examples/incrementer/ 24 | 25 | rm -f .perftable 26 | 27 | max=20 28 | 29 | for logi in `seq 0 $max` 30 | do 31 | $examplebindir/incrementer $i 2> .tmpperf 32 | 33 | grep "ms" .tmpperf 34 | grep "ms" .tmpperf | sed -e "s/^\(.*\) elems took \(.*\) ms$/\1 \2/" >> .perftable 35 | 36 | i=$((2 * $i)) 37 | done 38 | 39 | gnuplot > /dev/null << EOF 40 | set term postscript eps enhanced color 41 | set output "incrementer.eps" 42 | 43 | set xlabel "Number of iterations" 44 | set ylabel "Execution time (ms)" 45 | 46 | set logscale x 47 | set logscale y 48 | 49 | plot ".perftable" using 1:2 with linespoint title "Time" 50 | EOF 51 | -------------------------------------------------------------------------------- /tests/memory/memstress.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript landscape color 22 21 | set output "memstress.ps" 22 | set xlabel "Memory Pressure (MB)" 23 | set ylabel "execution time degradation (%)" 24 | set grid y 25 | set key left top box 26 | set datafile missing 'x' 27 | plot "timings/memstress.data" usi 1:(( 100*(($2 / 2130) - 1))) with linespoint title "matrix size : 4096" ,\ 28 | "timings/memstress.data" usi 1:(( 100*(($3 / 16420) - 1) )) with linespoint title "8192" 29 | -------------------------------------------------------------------------------- /tests/memory/memstress2.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript landscape color 22 21 | set output "memstress2.ps" 22 | set xlabel "Problem size" 23 | set ylabel "execution time" 24 | set logscale x 25 | set key left top 26 | set datafile missing 'x' 27 | plot "timings/memstress2.data" usi 1:2 with lines title "reference" ,\ 28 | "timings/memstress2.data" usi 1:3 with lines title "350 MB" 29 | -------------------------------------------------------------------------------- /tests/microbenchs/null_kernel_gordon.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | void empty_kernel (__attribute__ ((unused)) void **alloc, 18 | __attribute__ ((unused)) void **in, 19 | __attribute__ ((unused)) void **inout, 20 | __attribute__ ((unused)) void **out) 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /tests/mult/gflops.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "gflops.eps" 22 | set title "Matrix multiplication : impact of granularity" 23 | set xlabel "matrices size" 24 | set ylabel "GFlops" 25 | set logscale x 26 | set key right bottom 27 | set datafile missing 'x' 28 | plot "timings/gflops.data" usi 1:(2*$1*$1*$1 / ($2* 1000000)) with lines title "tile 256" ,\ 29 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / ($3* 1000000)) with lines title "tile 512" ,\ 30 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / ($4* 1000000)) with lines title "tile 1024" ,\ 31 | "timings/gflops.data" usi 1:(2*$1*$1*$1 / ($5* 1000000)) with lines title "tile 2048" 32 | -------------------------------------------------------------------------------- /tests/mult/sched.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "sched.eps" 22 | set title "Matrix multiplication : impact of the scheduling policy" 23 | set xlabel "matrices size" 24 | set ylabel "GFlops" 25 | set logscale x 26 | set key right bottom 27 | set datafile missing 'x' 28 | plot "timings/gflops.data.greedy" usi 1:(2*$1*$1*$1 / ($2* 1000000)) with lines title "greedy" ,\ 29 | "timings/gflops.data.dm" usi 1:(2*$1*$1*$1 / ($2* 1000000)) with lines title "dm" 30 | -------------------------------------------------------------------------------- /tests/mult/sched.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | maxiter=5 20 | 21 | trace_sched() 22 | { 23 | sched=$1 24 | 25 | for blocks in `seq 2 1 24` 26 | do 27 | size=$(($blocks*1024)) 28 | 29 | echo "size : $size" 30 | 31 | OPTIONS="-pin -nblocks $blocks -x $size -y $size -z 1024" 32 | 33 | cd $ROOTDIR 34 | filename=$TIMINGDIR/sched.$sched.$size 35 | 36 | for iter in `seq 1 $maxiter` 37 | do 38 | echo "$iter / $maxiter" 39 | #echo "$ROOTDIR/examples/mult/sgemm $OPTIONS 2> /dev/null" 40 | STARPU_NCUDA=1 STARPU_CALIBRATE=1 STARPU_SCHED="$sched" $ROOTDIR/examples/mult/sgemm $OPTIONS 2> /dev/null >> $filename 41 | tail -1 $filename 42 | done 43 | done 44 | } 45 | 46 | DIR=$PWD 47 | ROOTDIR=$DIR/../.. 48 | TIMINGDIR=$DIR/timings-sched/ 49 | mkdir -p $TIMINGDIR 50 | 51 | schedlist="random random random greedy greedy dm" 52 | 53 | for iter in `seq 1 10000` 54 | do 55 | echo "ITER $iter" 56 | for sched in $schedlist 57 | do 58 | trace_sched $sched; 59 | done 60 | 61 | done 62 | -------------------------------------------------------------------------------- /tests/mult/speedup.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | 20 | set term postscript eps enhanced color 21 | set output "speedup.eps" 22 | set title "Matrix multiplication" 23 | set xlabel "number of CPUs" 24 | set ylabel "speedup" 25 | plot "timings/speedup.4096" usi 1:1 with lines title "ideal",\ 26 | "timings/speedup.2048" usi 1:($3/$2) with lines title "2048",\ 27 | "timings/speedup.4096" usi 1:($3/$2) with lines title "4096",\ 28 | "timings/speedup.8192" usi 1:($3/$2) with lines title "8192" 29 | -------------------------------------------------------------------------------- /tests/mult/speedup.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | DIR=$PWD 20 | ROOTDIR=$DIR/../.. 21 | 22 | TIMINGDIR=$DIR/timings/ 23 | 24 | mkdir -p $TIMINGDIR 25 | cd $ROOTDIR 26 | 27 | make clean 1> /dev/null 2> /dev/null 28 | make examples STARPU_ATLAS=1 CPUS=16 1> /dev/null 2> /dev/null 29 | 30 | echo "speedup ..." 31 | 32 | for size in 2048 4096 8192 33 | do 34 | echo "# ncpus time reftime" > $TIMINGDIR/speedup.$size 35 | 36 | for cpus in 1 2 4 6 8 10 12 14 16 37 | do 38 | export STARPU_NCPUS=$cpus 39 | 40 | echo "ncpus $cpus size $size" 41 | 42 | filename=$TIMINGDIR/timing.$cpus.$size 43 | $ROOTDIR/examples/mult/dw_mult -x $size -y $size -z $size -nblocks 16 2>/dev/null| tee $filename 44 | 45 | echo "$cpus `cat $TIMINGDIR/timing.$cpus.$size` `cat $TIMINGDIR/timing.1.$size`" >> $TIMINGDIR/speedup.$size 46 | done 47 | done 48 | -------------------------------------------------------------------------------- /tests/perf_models/error_model.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot -persist 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | set term postscript eps enhanced color 20 | set output "model_error.eps" 21 | 22 | set yrange [0.05:100] 23 | set xrange [4:10000] 24 | 25 | set grid y 26 | set grid x 27 | 28 | set logscale y 29 | set logscale x 30 | 31 | #set title "Cholesky on Cell (PS3)" 32 | set xlabel "Number of samples" 33 | set ylabel "Prediction error" 34 | set grid 35 | 36 | 37 | set ytics (0.01, 0.1, 1, 5,10,25,50,100) 38 | set xtics (10, 100, 1000, 10000) 39 | 40 | set format y "%.1f %%" 41 | set format x "10^{%L}" 42 | 43 | set key title "Execution time Prediction Error (%)" 44 | 45 | set size 0.75 46 | 47 | plot "gnuplot.data" usi 1:($2*100) with linespoint pt -1 lt 1 lw 3 title "CPUs" ,\ 48 | "gnuplot.data" usi 3:($4*100) with linespoint pt -1 lt 2 lw 3 title "GPU" 49 | -------------------------------------------------------------------------------- /tests/regression/profiles.build.only.in: -------------------------------------------------------------------------------- 1 | # Build configuration 2 | 3 | # Build configuration 4 | --enable-coverage 5 | # Build configuration 6 | --disable-opencl 7 | # Build configuration 8 | --disable-cuda 9 | # Build configuration 10 | --disable-cuda --disable-opencl 11 | # Build configuration 12 | --enable-cuda --disable-opencl 13 | # Build configuration 14 | --disable-cuda --enable-opencl 15 | # Build configuration 16 | --with-fxt 17 | -------------------------------------------------------------------------------- /tests/regression/profiles.in: -------------------------------------------------------------------------------- 1 | # Build configuration 2 | --enable-coverage 3 | # Execution configuration 4 | 5 | # Build configuration 6 | --enable-debug --enable-verbose 7 | # Execution configuration 8 | STARPU_LOGFILENAME=/tmp/starpu_run.log 9 | # 10 | # Build configuration 11 | 12 | # Execution configuration 13 | STARPU_NCUDA=0 14 | # Execution configuration 15 | STARPU_NCUDA=1 16 | # Execution configuration 17 | STARPU_SCHED=ws 18 | # Execution configuration 19 | STARPU_SCHED=prio 20 | # Execution configuration 21 | STARPU_SCHED=no-prio 22 | # Execution configuration 23 | STARPU_SCHED=dm 24 | # Execution configuration 25 | STARPU_SCHED=dmda 26 | # Execution configuration 27 | STARPU_SCHED=random 28 | # Execution configuration 29 | STARPU_SCHED=eager 30 | # Execution configuration 31 | STARPU_SCHED=dmda STARPU_SCHED_ALPHA=10 STARPU_SCHED_BETA=15 32 | # Execution configuration 33 | STARPU_CALIBRATE=1 34 | # Execution configuration 35 | STARPU_PREFETCH=1 36 | # 37 | # Build configuration 38 | --disable-cuda 39 | # Execution configuration 40 | 41 | # 42 | # Build configuration 43 | --disable-opencl 44 | # Execution configuration 45 | 46 | -------------------------------------------------------------------------------- /tools/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # StarPU 3 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2009 (see AUTHORS file) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; either version 2.1 of the License, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | # 14 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | # 16 | 17 | SUBDIRS = 18 | 19 | AM_CFLAGS = $(HWLOC_CFLAGS) 20 | LIBS = $(top_builddir)/src/libstarpu.la $(HWLOC_LIBS) @LIBS@ 21 | AM_CPPFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/tools/ -I$(top_srcdir)/mpi/ -I$(top_builddir)/src -I$(top_srcdir)/src 22 | 23 | bin_PROGRAMS = 24 | 25 | CLEANFILES = *.gcno *.gcda *.linkinfo 26 | 27 | bin_PROGRAMS += calibrate_bus 28 | 29 | calibrate_bus_SOURCES = calibrate_bus.c 30 | 31 | if STARPU_USE_FXT 32 | bin_PROGRAMS += fxt_tool fxt_stats 33 | 34 | fxt_tool_SOURCES = fxt_tool.c fxt_tool_common.c fxt_tool_mpi.c dag_dot.c histo_paje.c 35 | fxt_tool_CFLAGS = -I$(top_srcdir)/src/ 36 | fxt_tool_LDADD = 37 | 38 | fxt_stats_SOURCES = fxt_stats.c 39 | fxt_stats_CFLAGS = -I$(top_srcdir)/src/ 40 | endif 41 | 42 | bin_PROGRAMS += perfmodel_display 43 | perfmodel_display_SOURCES = perfmodel_display.c 44 | 45 | noinst_HEADERS = \ 46 | fxt_tool.h \ 47 | histo_paje.h 48 | -------------------------------------------------------------------------------- /tools/calibrate_bus.c: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #include 18 | 19 | int main(int argc, char **argv) 20 | { 21 | #ifdef __MINGW32__ 22 | WSADATA wsadata; 23 | WSAStartup(MAKEWORD(1,0), &wsadata); 24 | #endif 25 | 26 | starpu_force_bus_sampling(); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tools/distrib/distrib.r: -------------------------------------------------------------------------------- 1 | t<-read.table("output.update_block"); 2 | 3 | plot.multi.dens <- function(s) 4 | { 5 | junk.x = NULL 6 | junk.y = NULL 7 | for(i in 1:length(s)) 8 | { 9 | junk.x = c(junk.x, density(s[[i]])$x) 10 | junk.y = c(junk.y, density(s[[i]])$y) 11 | } 12 | xr <- range(junk.x) 13 | yr <- range(junk.y) 14 | 15 | plot(density(s[[1]]), xlim = xr, ylim = yr, main="") 16 | for(i in 1:length(s)) 17 | { 18 | lines(density(s[[i]]), xlim = xr, ylim = yr, col = i) 19 | } 20 | } 21 | 22 | cpus <- seq(1, 8); 23 | 24 | per_cpu <- function(cpuid) 25 | { 26 | t[4][t[2] == cpuid]; 27 | } 28 | 29 | density_cpu <- function(cpuid) 30 | { 31 | density(per_cpu(cpuid)) 32 | } 33 | 34 | l <- list() 35 | leg <- c() 36 | 37 | for (cpu in 1:4) 38 | { 39 | l <- c(l, list(per_cpu(cpu))) 40 | leg <- c(leg, cpu) 41 | } 42 | 43 | 44 | library(Hmisc) 45 | 46 | plot.multi.dens( l); 47 | le <- largest.empty(per_cpu(0), per_cpu(1), 0.1, 0.1) 48 | legend(le,legend=leg, col=(1:8), lwd=2, lty = 1) 49 | -------------------------------------------------------------------------------- /tools/distrib/distrib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | filename=$1 20 | 21 | symbol_list=`cut -f1 $filename|sort -u` 22 | 23 | for symbol in $symbol_list 24 | do 25 | echo $symbol 26 | 27 | grep "^$symbol" $filename > output.$symbol 28 | 29 | 30 | done 31 | -------------------------------------------------------------------------------- /tools/histo_paje.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StarPU 3 | * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2.1 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU Lesser General Public License in COPYING.LGPL for more details. 15 | */ 16 | 17 | #ifndef __HISTO_PAJE_H__ 18 | #define __HISTO_PAJE_H__ 19 | 20 | #include 21 | 22 | void write_paje_header(FILE *file); 23 | 24 | #endif // __HISTO_PAJE_H__ 25 | -------------------------------------------------------------------------------- /tools/model_distrib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # StarPU 5 | # Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file) 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation; either version 2.1 of the License, or (at 10 | # your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # See the GNU Lesser General Public License in COPYING.LGPL for more details. 17 | # 18 | 19 | create_histograms() 20 | { 21 | 22 | inputfile=$1 23 | 24 | R --no-save > /dev/null << EOF 25 | 26 | handle_hash <- function (hash) 27 | { 28 | 29 | val <- table[table[,1]==hash,3] 30 | 31 | 32 | # there is certainly a better way to do this ! 33 | size <- unique(table[table[,1]==hash,2]) 34 | 35 | pdf(paste("$inputfile", hash, size, "pdf", sep=".")); 36 | 37 | h <- hist(val[val > quantile(val,0.01) & val $inputfile.$arch.$h 32 | done 33 | done 34 | 35 | # create the gnuplot file 36 | 37 | gpfile=$inputfile.gp 38 | 39 | echo "#!/usr/bin/gnuplot -persist" > $gpfile 40 | echo "set term postscript eps enhanced color" >> $gpfile 41 | echo "set logscale x" >> $gpfile 42 | echo "set logscale y" >> $gpfile 43 | echo "set output \"$inputfile.eps\"" >> $gpfile 44 | 45 | echo -n "plot " >> $gpfile 46 | 47 | first=1 48 | 49 | for arch in $archlist 50 | do 51 | for h in $hashlist 52 | do 53 | if [ $first = 0 ] 54 | then 55 | echo -n " , " >> $gpfile 56 | else 57 | first=0 58 | fi 59 | 60 | echo -n " \"$inputfile.$arch.$h\" using 3:4 title \"arch $arch hash $h\" " >> $gpfile 61 | done 62 | done 63 | 64 | gnuplot $gpfile 65 | --------------------------------------------------------------------------------