Mentions légales du service

Skip to content
Snippets Groups Projects
Closed Adding GPU kernels such as geadd
  • View options
  • Adding GPU kernels such as geadd

  • View options
  • Closed Issue created by Mathieu Faverge

    We would like to port some kernels to GPU to minimize the CPU-GPU data transfer. I have started with zgeadd: I added the cl_zgeadd_cuda_func definition to its codelet, and I added cuda_zgeadd to call cublasZgeam as follows:

    #include "cudablas/include/cudablas.h"
    #include "cudablas/include/cudablas_z.h"
    
    int CUDA_zgeadd(MORSE_enum trans,
                   int m, int n,
                   cuDoubleComplex *alpha,
                   const cuDoubleComplex *A, int lda,
                   cuDoubleComplex *beta,
                   cuDoubleComplex *B, int ldb,
                   CUBLAS_STREAM_PARAM)
    {
    
    #if !defined(CHAMELEON_USE_CUBLAS_V2)
        cublasSetKernelStream( stream );
    #endif
        //cublasHandle_t handle;
        //cublasZgeam(handle,
        cublasZgeam(CUBLAS_HANDLE
                    morse_lapack_const(trans), morse_lapack_const(MorseNoTrans),
                    m, n,
                    CUBLAS_VALUE(alpha), A, lda,
                    CUBLAS_VALUE(beta), B, ldb,
                    B, ldb);
        assert( CUBLAS_STATUS_SUCCESS == cublasGetError() );
    
        return MORSE_SUCCESS;
    }

    I am using spack to install chameleon v0.9.1 with starpu v1.2.1. I got the following errors and warnings:

    compilation aborted for /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_zgeadd.c (code 2)
    make[2]: *** [cudablas/compute/CMakeFiles/cudablas.dir/cuda_zgeadd.c.o] Error 2
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(45): warning #167: argument of type "char" is incompatible with parameter of type "cublasHandle_t"
                      morse_lapack_const(trans), morse_lapack_const(MorseNoTrans),
                      ^
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(48): warning #167: argument of type "int" is incompatible with parameter of type "const double *"
                      CUBLAS_VALUE(alpha), A, lda,
                                              ^
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(49): warning #167: argument of type "int" is incompatible with parameter of type "const double *"
                      CUBLAS_VALUE(beta), B, ldb,
                                             ^
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(50): warning #810: conversion from "double *" to "int" may lose significant bits
                      B, ldb);
                      ^
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(50): warning #167: argument of type "int" is incompatible with parameter of type "double *"
                      B, ldb);
                         ^
    /home/sukkarde/codes/chameleon/spack-build/cudablas/compute/cuda_dgeadd.c(50): error #165: too few arguments in function call
                      B, ldb);

    If I add cublasHandle_t handle instead of CUBLAS_HANDLE, then I got a wrong results. Could you please advice how to solve this issue ?

    Linked items 0

  • Link items together to show that they're related.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first