Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6ae3b3ac authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

Fix --forcegpu option to be able to force starpu to execute kernels on gpus,...

Fix --forcegpu option to be able to force starpu to execute kernels on gpus, RUNTIME_CUDA was not well defined and introduce RUNTIME_HIP.
parent 6e1f395b
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,8 @@ typedef enum runtime_id_e { ...@@ -39,7 +39,8 @@ typedef enum runtime_id_e {
* @brief Ids of the worker type * @brief Ids of the worker type
*/ */
#define RUNTIME_CPU ((1ULL)<<1) #define RUNTIME_CPU ((1ULL)<<1)
#define RUNTIME_CUDA ((1ULL)<<3) #define RUNTIME_CUDA ((1ULL)<<2)
#define RUNTIME_HIP ((1ULL)<<3)
/** /**
* @brief RUNTIME request structure * @brief RUNTIME request structure
......
...@@ -23,11 +23,32 @@ ...@@ -23,11 +23,32 @@
#include "chameleon_starpu.h" #include "chameleon_starpu.h"
#include "runtime_codelet_z.h" #include "runtime_codelet_z.h"
#ifdef CHAMELEON_USE_CUDA #if defined(CHAMELEON_USE_CUDA) || defined(CHAMELEON_USE_HIP)
/* Convert worker id from Chameleon to Starpu */
static uint32_t cham_to_starpu_where( uint32_t where )
{
int32_t starpu_where = 0;
if ( where & RUNTIME_CPU ) {
starpu_where |= STARPU_CPU;
}
if ( where & RUNTIME_CUDA ) {
starpu_where |= STARPU_CUDA;
}
if ( where & RUNTIME_HIP ) {
starpu_where |= STARPU_HIP;
}
return starpu_where;
}
/* Only codelets with multiple choices are present here */ /* Only codelets with multiple choices are present here */
void RUNTIME_zlocality_allrestrict( uint32_t where ) void RUNTIME_zlocality_allrestrict( uint32_t where )
{ {
/* Convert worker id from Chameleon to Starpu */
where = cham_to_starpu_where( where );
/* Blas 3 */ /* Blas 3 */
cl_zgemm_restrict_where( where ); cl_zgemm_restrict_where( where );
#if defined(PRECISION_z) || defined(PRECISION_c) #if defined(PRECISION_z) || defined(PRECISION_c)
...@@ -73,6 +94,9 @@ void RUNTIME_zlocality_allrestrict( uint32_t where ) ...@@ -73,6 +94,9 @@ void RUNTIME_zlocality_allrestrict( uint32_t where )
void RUNTIME_zlocality_onerestrict( cham_tasktype_t kernel, uint32_t where ) void RUNTIME_zlocality_onerestrict( cham_tasktype_t kernel, uint32_t where )
{ {
/* Convert worker id from Chameleon to Starpu */
where = cham_to_starpu_where( where );
switch( kernel ) { switch( kernel ) {
/* Blas 3 */ /* Blas 3 */
case TASK_GEMM: cl_zgemm_restrict_where( where ); break; case TASK_GEMM: cl_zgemm_restrict_where( where ); break;
......
...@@ -208,7 +208,18 @@ int main (int argc, char **argv) { ...@@ -208,7 +208,18 @@ int main (int argc, char **argv) {
info = 1; info = 1;
goto end; goto end;
} }
RUNTIME_zlocality_allrestrict( RUNTIME_CUDA ); #if defined(CHAMELEON_SCHED_STARPU)
int restriction = 0;
#if defined(CHAMELEON_USE_CUDA)
restriction |= RUNTIME_CUDA;
#endif
#if defined(CHAMELEON_USE_HIP)
restriction |= RUNTIME_HIP;
#endif
if ( restriction != 0 ) {
RUNTIME_zlocality_allrestrict( restriction );
}
#endif
} }
/* Warmup */ /* Warmup */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment