Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b4bd62c2 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'hipblas' into 'master'

Added support for HIP and hipblas (CUDA and ROC backend)

See merge request !355
parents 6d65c096 6438b39a
No related branches found
No related tags found
1 merge request!355Added support for HIP and hipblas (CUDA and ROC backend)
Showing
with 1232 additions and 11 deletions
......@@ -28,7 +28,8 @@
# @author Samuel Thibault
# @author Guillaume Sylvand
# @author Alycia Lisito
# @date 2022-02-22
# @author Loris Lucido
# @date 2023-01-30
#
###
cmake_minimum_required(VERSION 3.3)
......@@ -188,6 +189,11 @@ if ( CHAMELEON_SCHED_PARSEC OR CHAMELEON_SCHED_STARPU )
set(CHAMELEON_ENABLE_CUDA ON FORCE)
endif()
set(CHAMELEON_ENABLE_HIP OFF CACHE INTERNAL "Tells if HIP might be supported by the runtime")
if ( CHAMELEON_SCHED_STARPU )
set(CHAMELEON_ENABLE_HIP ON FORCE)
endif()
# Additional options
# ------------------
......@@ -217,6 +223,20 @@ if (CHAMELEON_ENABLE_CUDA AND NOT CHAMELEON_USE_CUDA)
message("-- ${BoldGreen}CHAMELEON_USE_CUDA is set to OFF, turn it ON to use CUDA (unsupported by Quark)${ColourReset}")
endif()
cmake_dependent_option(CHAMELEON_USE_HIP_CUDA
"Enable HIP kernels with CUDA backend" OFF
"CHAMELEON_ENABLE_HIP" OFF)
cmake_dependent_option(CHAMELEON_USE_HIP_ROC
"Enable HIP kernels with ROCclr backend" OFF
"CHAMELEON_ENABLE_HIP" OFF)
set(CHAMELEON_USE_HIP OFF CACHE INTERNAL "Equivalent to CHAMELEON_USE_CUDA for HIP. Enabled only of one of the CHAMELEON_USE_HIP{CUDA,ROC} is enabled")
if( CHAMELEON_USE_HIP_CUDA OR CHAMELEON_USE_HIP_ROC )
set(CHAMELEON_USE_HIP ON)
else()
set(CHAMELEON_USE_HIP OFF)
endif()
# Enable Hmat-OSS kernels
option(CHAMELEON_USE_HMAT "Enable hmat kernels" OFF)
cmake_dependent_option(CHAMELEON_HMAT_EXTERNAL
......@@ -405,6 +425,121 @@ if(NOT CHAMELEON_SIMULATION)
endif(CHAMELEON_USE_CUDA)
# CHAMELEON depends on HIP/HIPBLAS
#----------------------------------
if (CHAMELEON_USE_HIP)
if (CHAMELEON_USE_HIP_ROC)
find_package(HIP REQUIRED)
find_package(hipblas REQUIRED)
elseif(CHAMELEON_USE_HIP_CUDA)
# for CUDA backend we need a user-provided hipblas library as the one
# shipped with ROCm only works with AMD GPU
set(CHAMELEON_HIPBLAS_PATH "" CACHE PATH "Directory of hipblas installation with CUDA support")
if(NOT CHAMELEON_HIPBLAS_PATH)
message(FATAL_ERROR "CHAMELEON_USE_HIP_CUDA requires you to set"
" CHAMELEON_HIPBLAS_PATH to a hipblas installation compiled with CUDA")
endif()
if(NOT DEFINED HIP_PATH)
if(DEFINED ENV{HIP_PATH})
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed")
else()
message(FATAL_ERROR "Please set HIP_PATH to your HIP installation.")
endif()
endif()
find_package(CUDA REQUIRED)
# location of FindHIP.cmake depending on how HIP_PATH is set
# HIP_PATH points to /opt/rocm-<version>
set(CMAKE_MODULE_PATH "${HIP_PATH}/lib/cmake/hip" ${CMAKE_MODULE_PATH})
# HIP_PATH points to /opt/rocm-<version>/hip
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
# We use MODULE keyword to force using FindHIP.cmake instead of
# hip-config.cmake which doesn't support CUDA backend
find_package(HIP REQUIRED MODULE)
list( APPEND HIP_INCLUDE_DIRS "${HIP_PATH}/include")
if(CHAMELEON_HIPBLAS_PATH)
list(APPEND HIPBLAS_INCLUDE_DIRS "${CHAMELEON_HIPBLAS_PATH}/include")
list(APPEND HIPBLAS_LIBRARIES "${CHAMELEON_HIPBLAS_PATH}/lib/libhipblas.so")
else()
message(FATAL_ERROR "Please set CHAMELEON_HIPBLAS_PATH to your HIPBLAS installation.")
endif()
endif()
if (HIP_FOUND)
message("-- ${Blue}Add definition CHAMELEON_USE_HIP"
" - Activate HIP in Chameleon${ColourReset}")
# create imported target because not provided with old cmake
add_library(HIP::HIP INTERFACE IMPORTED)
add_library(HIP::HIPBLAS INTERFACE IMPORTED)
if (CHAMELEON_USE_HIP_CUDA)
target_compile_definitions(HIP::HIP INTERFACE "__HIP_PLATFORM_NVIDIA__")
set(HIP_INCLUDE_DIRS "${HIP_INCLUDE_DIRS};${CUDA_INCLUDE_DIRS}")
set(HIP_LIBRARIES "${HIP_LIBRARIES};${CUDA_LIBRARIES}")
endif()
if (HIP_INCLUDE_DIRS)
set_target_properties(HIP::HIP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HIP_INCLUDE_DIRS}")
if (HIPBLAS_INCLUDE_DIRS)
set_target_properties(HIP::HIPBLAS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HIPBLAS_INCLUDE_DIRS}")
else()
message(WARNING "CHAMELEON_USE_HIP requires"
"\n HIPBLAS_INCLUDE_DIRS to be found. Be sure you have"
"\n hipblas headers with your distribution of HIP.")
endif()
else()
message(WARNING "CHAMELEON_USE_HIP requires"
"\n HIP_INCLUDE_DIRS to be found. Be sure you have"
"\n hip headers with your distribution of HIP.")
endif()
if (HIP_LIBRARIES)
set_target_properties(HIP::HIP PROPERTIES INTERFACE_LINK_LIBRARIES "${HIP_LIBRARIES}")
if (HIPBLAS_LIBRARIES)
set_target_properties(HIP::HIPBLAS PROPERTIES INTERFACE_LINK_LIBRARIES "${HIPBLAS_LIBRARIES}")
target_link_libraries(HIP::HIPBLAS INTERFACE HIP::HIP)
message("-- ${Blue}Add definition CHAMELEON_USE_HIPBLAS"
" - Use GPU kernels from hipblas${ColourReset}")
else()
message(FATAL_ERROR "CHAMELEON_USE_HIP requires"
"\n HIPBLAS_LIBRARIES to be found. Be sure you have"
"\n libhipblas with your distribution of HIP.")
endif()
else()
message(FATAL_ERROR "CHAMELEON_USE_HIP requires"
"\n HIP_LIBRARIES to be found. Be sure you have"
"\n libamdhip64 with your distribution of ROCm.")
endif()
if (CHAMELEON_USE_HIP_CUDA AND NOT CUDA_LIBRARIES)
message(FATAL_ERROR "CHAMELEON_USE_HIP_CUDA requires"
"\n CUDA_LIBRARIES to be found. Be sure you have"
"\n libcuda with your distribution of CUDA.")
endif()
message("-- HIP PATH: ${HIP_PATH}")
message("-- HIP version: ${HIP_VERSION_STRING}")
message("-- HIP platform: ${HIP_PLATFORM}")
message("-- HIP runtime: ${HIP_RUNTIME}")
message("-- HIP compiler: ${HIP_COMPILER}")
message("-- HIP include path: ${HIP_INCLUDE_DIRS}")
message("-- HIP libraries: ${HIP_LIBRARIES}")
message("-- HIPBLAS include path: ${HIPBLAS_INCLUDE_DIRS}")
message("-- HIPBLAS libraries: ${HIPBLAS_LIBRARIES}")
morse_export_imported_target(HIP HIP hip chameleon)
morse_export_imported_target(HIP HIPBLAS hipblas chameleon)
else(HIP_FOUND)
message(FATAL_ERROR "CHAMELEON_USE_HIP requires HIP to be found")
endif (HIP_FOUND)
endif(CHAMELEON_USE_HIP)
# CHAMELEON depends on MPI
#-------------------------
if (CHAMELEON_USE_MPI)
......@@ -565,6 +700,9 @@ if (NOT CHAMELEON_SIMULATION)
if(CHAMELEON_USE_CUDA)
add_subdirectory(cudablas)
endif()
if(CHAMELEON_USE_HIP)
add_subdirectory(hipblas)
endif()
endif()
......
......@@ -53,4 +53,8 @@ if(NOT BUILDNAME)
set(BUILDNAME "${BUILDNAME}-CUDA")
endif(CHAMELEON_USE_CUDA)
if(CHAMELEON_USE_HIP)
set(BUILDNAME "${BUILDNAME}-HIP")
endif(CHAMELEON_USE_HIP)
endif()
......@@ -20,7 +20,8 @@
# @version 1.2.0
# @author Florent Pruvost
# @author Mathieu Faverge
# @date 2022-02-22
# @author Loris Lucido
# @date 2023-01-30
#
###
......@@ -74,6 +75,8 @@ set(dep_message "${dep_message}"
"\n"
" Implementation paradigm\n"
" CUDA ................: ${CHAMELEON_USE_CUDA}\n"
" HIP-ROC .............: ${CHAMELEON_USE_HIP_ROC}\n"
" HIP-CUDA ............: ${CHAMELEON_USE_HIP_CUDA}\n"
" MPI .................: ${CHAMELEON_USE_MPI}\n"
"\n"
" Runtime specific\n"
......
......@@ -25,7 +25,8 @@
# @author Guillaume Sylvand
# @author Raphael Boucherie
# @author Alycia Lisito
# @date 2022-02-22
# @author Loris Lucido
# @date 2023-01-30
#
###
......@@ -344,6 +345,12 @@ if (CHAMELEON_USE_CUDA)
target_link_libraries(chameleon PUBLIC CUDA::CUBLAS)
endif()
endif()
if (CHAMELEON_USE_HIP)
if (NOT CHAMELEON_SIMULATION)
target_link_libraries(chameleon PUBLIC hipblas)
target_link_libraries(chameleon PUBLIC HIP::HIPBLAS)
endif()
endif()
target_link_libraries(chameleon PUBLIC MORSE::M)
set_property(TARGET chameleon PROPERTY Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
......
......@@ -19,7 +19,8 @@
* @author Philippe Virouleau
* @author Samuel Thibault
* @author Philippe Swartvagher
* @date 2022-02-22
* @author Loris Lucido
* @date 2023-01-30
*
***
*
......@@ -65,7 +66,7 @@ int __chameleon_init(int cores, int gpus)
* @param[in] ncpus
* Number of cores to use.
*
* @param[in] ncudas
* @param[in] ngpus
* Number of cuda devices to use.
*
* @param[in] nthreads_per_worker
......@@ -76,7 +77,7 @@ int __chameleon_init(int cores, int gpus)
* @retval CHAMELEON_SUCCESS successful exit
*
*/
int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker)
int __chameleon_initpar(int ncpus, int ngpus, int nthreads_per_worker)
{
CHAM_context_t *chamctxt;
......@@ -113,14 +114,14 @@ int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker)
# endif
#endif
#if !defined(CHAMELEON_USE_CUDA)
if ( ncudas != 0 ) {
chameleon_warning("CHAMELEON_Init", "CHAMELEON_USE_CUDA is not defined, ncudas is forced to 0");
ncudas = 0;
#if !defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_USE_HIP)
if ( ngpus != 0 ) {
chameleon_warning("CHAMELEON_Init", "CHAMELEON_USE_CUDA or CHAMELEON_USE_HIP are not defined, ngpus is forced to 0");
ngpus = 0;
}
#endif
return RUNTIME_init( chamctxt, ncpus, ncudas, nthreads_per_worker );
return RUNTIME_init( chamctxt, ncpus, ngpus, nthreads_per_worker );
}
/**
......
###
#
# @file CMakeLists.txt
#
# @copyright 2009-2014 The University of Tennessee and The University of
# Tennessee Research Foundation. All rights reserved.
# @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @project CHAMELEON
# CHAMELEON is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.2.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @author Loris Lucido
# @date 2023-01-30
#
###
add_subdirectory(include)
add_subdirectory(compute)
add_subdirectory(eztrace_module)
###
### END CMakeLists.txt
###
###
#
# @file CMakeLists.txt
#
# @copyright 2009-2014 The University of Tennessee and The University of
# Tennessee Research Foundation. All rights reserved.
# @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @project CHAMELEON
# CHAMELEON is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.2.0
# @author Florent Pruvost
# @author Guillaume Sylvand
# @author Mathieu Faverge
# @author Loris Lucido
# @date 2023-01-30
#
###
# Generate the chameleon sources for all possible precisions
# ------------------------------------------------------
set(HIPBLAS_SRCS_GENERATED "")
set(ZSRC
hip_zgemm.c
hip_zhemm.c
hip_zher2k.c
hip_zherk.c
hip_zsymm.c
hip_zsyr2k.c
hip_zsyrk.c
hip_ztrmm.c
hip_ztrsm.c
)
precisions_rules_py(
HIPBLAS_SRCS_GENERATED "${ZSRC}"
PRECISIONS "${CHAMELEON_PRECISION}")
set(HIPBLAS_SRCS
${HIPBLAS_SRCS_GENERATED}
hipglobal.c
)
# Force generation of sources
# ---------------------------
add_custom_target(hipblas_sources ALL SOURCES ${HIPBLAS_SRCS})
set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};hipblas_sources" CACHE INTERNAL "List of targets of sources")
# Compile step
# ------------
add_library(hipblas ${HIPBLAS_SRCS})
set_target_properties(hipblas PROPERTIES VERSION ${CHAMELEON_VERSION})
set_target_properties(hipblas PROPERTIES SOVERSION ${CHAMELEON_VERSION_MAJOR})
add_dependencies(hipblas hipblas_include hipblas_sources)
target_include_directories(hipblas PUBLIC
$<BUILD_INTERFACE:${CHAMELEON_SOURCE_DIR}/hipblas/include>
$<BUILD_INTERFACE:${CHAMELEON_BINARY_DIR}/hipblas/include>
$<BUILD_INTERFACE:${CHAMELEON_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CHAMELEON_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_property(TARGET hipblas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
target_link_libraries(hipblas PRIVATE coreblas HIP::HIPBLAS)
target_link_libraries(hipblas PUBLIC MORSE::M)
# export target coreblas
install(EXPORT hipblasTargets
NAMESPACE CHAMELEON::
DESTINATION lib/cmake/chameleon
)
# installation
# ------------
install(TARGETS hipblas
EXPORT hipblasTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
###
### END CMakeLists.txt
###
/**
*
* @file hip_zgemm.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zgemm GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @author Loris Lucido
* @date 2023-01-30
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_zgemm( cham_trans_t transa, cham_trans_t transb,
int m, int n, int k,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *B, int ldb,
const hipDoubleComplex *beta,
hipDoubleComplex *C, int ldc,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZgemm( handle,
chameleon_hipblas_const(transa), chameleon_hipblas_const(transb),
m, n, k,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb,
HIPBLAS_VALUE(beta), C, ldc );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zhemm.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zhemm GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c
*
*/
#include "hipblas.h"
int
HIP_zhemm( cham_side_t side, cham_uplo_t uplo,
int m, int n,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *B, int ldb,
const hipDoubleComplex *beta,
hipDoubleComplex *C, int ldc,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZhemm( handle,
chameleon_hipblas_const(side), chameleon_hipblas_const(uplo),
m, n,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb,
HIPBLAS_VALUE(beta), C, ldc );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zher2k.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zher2k GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c
*
*/
#include "hipblas.h"
int
HIP_zher2k( cham_uplo_t uplo, cham_trans_t trans,
int n, int k,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *B, int ldb,
const double *beta,
hipDoubleComplex *C, int ldc,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZher2k( handle,
chameleon_hipblas_const(uplo), chameleon_hipblas_const(trans),
n, k,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb,
HIPBLAS_VALUE(beta), C, ldc );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zherk.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zherk GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c
*
*/
#include "hipblas.h"
int
HIP_zherk( cham_uplo_t uplo, cham_trans_t trans,
int n, int k,
const double *alpha,
const hipDoubleComplex *A, int lda,
const double *beta,
hipDoubleComplex *B, int ldb,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZherk( handle,
chameleon_hipblas_const(uplo), chameleon_hipblas_const(trans),
n, k,
HIPBLAS_VALUE(alpha), A, lda,
HIPBLAS_VALUE(beta), B, ldb );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zsymm.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zsymm GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_zsymm( cham_side_t side, cham_uplo_t uplo,
int m, int n,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *B, int ldb,
const hipDoubleComplex *beta,
hipDoubleComplex *C, int ldc,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZsymm( handle,
chameleon_hipblas_const(side), chameleon_hipblas_const(uplo),
m, n,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb,
HIPBLAS_VALUE(beta), C, ldc );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zsyr2k.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zsyr2k GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_zsyr2k( cham_uplo_t uplo, cham_trans_t trans,
int n, int k,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *B, int ldb,
const hipDoubleComplex *beta,
hipDoubleComplex *C, int ldc,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZsyr2k( handle,
chameleon_hipblas_const(uplo), chameleon_hipblas_const(trans),
n, k,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb,
HIPBLAS_VALUE(beta), C, ldc );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_zsyrk.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_zsyrk GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_zsyrk( cham_uplo_t uplo, cham_trans_t trans,
int n, int k,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
const hipDoubleComplex *beta,
hipDoubleComplex *B, int ldb,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZsyrk( handle,
chameleon_hipblas_const(uplo), chameleon_hipblas_const(trans),
n, k,
HIPBLAS_VALUE(alpha), A, lda,
HIPBLAS_VALUE(beta), B, ldb );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_ztrmm.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_ztrmm GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @date 2022-02-22
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_ztrmm( cham_side_t side, cham_uplo_t uplo,
cham_trans_t transa, cham_diag_t diag,
int m, int n,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
hipDoubleComplex *B, int ldb,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZtrmm( handle,
chameleon_hipblas_const(side), chameleon_hipblas_const(uplo),
chameleon_hipblas_const(transa), chameleon_hipblas_const(diag),
m, n,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hip_ztrsm.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon hip_ztrsm GPU kernel
*
* @version 1.2.0
* @author Florent Pruvost
* @author Mathieu Faverge
* @author Loris Lucido
* @date 2023-01-30
* @precisions normal z -> c d s
*
*/
#include "hipblas.h"
int
HIP_ztrsm( cham_side_t side, cham_uplo_t uplo,
cham_trans_t transa, cham_diag_t diag,
int m, int n,
const hipDoubleComplex *alpha,
const hipDoubleComplex *A, int lda,
hipDoubleComplex *B, int ldb,
hipblasHandle_t handle )
{
hipblasStatus_t rc;
rc = hipblasZtrsm( handle,
chameleon_hipblas_const(side), chameleon_hipblas_const(uplo),
chameleon_hipblas_const(transa), chameleon_hipblas_const(diag),
m, n,
HIPBLAS_VALUE(alpha), A, lda,
B, ldb );
assert( rc == HIPBLAS_STATUS_SUCCESS );
(void)rc;
return CHAMELEON_SUCCESS;
}
/**
*
* @file hipglobal.c
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon global hipblas variables and functions
*
* @version 1.2.0
* @author Mathieu Faverge
* @author Loris Lucido
* @date 2023-01-30
*
*/
#include "hipblas.h"
/**
* LAPACK Constants
*/
int chameleon_hipblas_constants[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 100
0, // 101: ChamRowMajor
0, // 102: ChamColMajor
0, 0, 0, 0, 0, 0, 0, 0,
HIPBLAS_OP_N, // 111: ChamNoTrans
HIPBLAS_OP_T, // 112: ChamTrans
HIPBLAS_OP_C, // 113: ChamConjTrans
0, 0, 0, 0, 0, 0, 0,
HIPBLAS_FILL_MODE_UPPER, // 121: ChamUpper
HIPBLAS_FILL_MODE_LOWER, // 122: ChamLower
0, // 123: ChamUpperLower
0, 0, 0, 0, 0, 0, 0,
HIPBLAS_DIAG_NON_UNIT, // 131: ChamNonUnit
HIPBLAS_DIAG_UNIT, // 132: ChamUnit
0, 0, 0, 0, 0, 0, 0, 0,
HIPBLAS_SIDE_LEFT, // 141: ChamLeft
HIPBLAS_SIDE_RIGHT, // 142: ChamRight
0, 0, 0, 0, 0, 0, 0, 0,
0, // 151:
0, // 152:
0, // 153:
0, // 154:
0, // 155:
0, // 156:
0, // 157: ChamEps
0, // 158:
0, // 159:
0, // 160:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 171: ChamOneNorm
0, // 172: ChamRealOneNorm
0, // 173: ChamTwoNorm
0, // 174: ChamFrobeniusNorm
0, // 175: ChamInfNorm
0, // 176: ChamRealInfNorm
0, // 177: ChamMaxNorm
0, // 178: ChamRealMaxNorm
0, // 179
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 200
0, // 201: ChamDistUniform
0, // 202: ChamDistSymmetric
0, // 203: ChamDistNormal
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 240
0, // 241 ChamHermGeev
0, // 242 ChamHermPoev
0, // 243 ChamNonsymPosv
0, // 244 ChamSymPosv
0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 290
0, // 291 ChamNoPacking
0, // 292 ChamPackSubdiag
0, // 293 ChamPackSupdiag
0, // 294 ChamPackColumn
0, // 295 ChamPackRow
0, // 296 ChamPackLowerBand
0, // 297 ChamPackUpeprBand
0, // 298 ChamPackAll
0, // 299
0, // 300
0, // 301 ChamNoVec
0, // 302 ChamVec, ChamSVDvrange
0, // 303 ChamIvec, ChamSVDirange
0, // 304 ChamAllVec, ChamSVDall
0, // 305 ChamSVec
0, // 306 ChamOVec
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 390
0, // 391 Forward
0, // 392 Backward
0, 0, 0, 0, 0, 0, 0, 0,
0, // 401 Columnwise
0, // 402 Rowwise
0, 0, 0, 0, 0, 0, 0, 0 // Remember to add a coma!
};
###
#
# @file CMakeLists.txt
#
# @copyright 2009-2014 The University of Tennessee and The University of
# Tennessee Research Foundation. All rights reserved.
# @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @project CHAMELEON
# CHAMELEON is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.2.0
# @author Florent Pruvost
# @author Mathieu Faverge
# @date 2022-02-22
#
###
if (NOT EZTRACE_FOUND)
find_package(EZTRACE)
endif()
if (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)
set(EZTRACE_eztrace_create_plugin_DIR "EZTRACE_eztrace_create_plugin_DIR-NOTFOUND")
find_path(EZTRACE_eztrace_create_plugin_DIR
NAMES eztrace_create_plugin
HINTS ${EZTRACE_DIR_FOUND}/bin)
mark_as_advanced(EZTRACE_eztrace_create_plugin_DIR)
if (EZTRACE_eztrace_create_plugin_DIR)
set(EZTRACE_CREATE_PLUGIN "${EZTRACE_eztrace_create_plugin_DIR}/eztrace_create_plugin")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output
COMMAND ${EZTRACE_CREATE_PLUGIN}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/hipblas_eztrace_module
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hipblas_eztrace_module
)
add_custom_target(
eztrace-module-chameleon_hip-dir ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output
)
add_custom_command(
OUTPUT libeztrace-convert-chameleon_hip.so
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output
)
add_custom_target(
eztrace-module-chameleon_hip-libs ALL
DEPENDS libeztrace-convert-chameleon_hip.so
)
# installation
# ------------
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-autostart-chameleon_hip.so
${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-chameleon_hip.so
${CMAKE_CURRENT_BINARY_DIR}/output/libeztrace-convert-chameleon_hip.so
DESTINATION ${EZTRACE_LIBRARY_DIRS}
)
endif (EZTRACE_eztrace_create_plugin_DIR)
endif (EZTRACE_FOUND AND EZTRACE_DIR_FOUND)
###
### END CMakeLists.txt
###
BEGIN_MODULE
NAME chameleon_hip
DESC "Module for Chameleon HIP functions"
ID 7771
int HIP_cgemm(
void* transa, void* transb,
int m, int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_chemm(
void* side, void* uplo,
int m, int n,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_cher2k(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
float *beta,
void *C, int ldc,
void* stream);
int HIP_cherk(
void* uplo, void* trans,
int n, int k,
float *alpha,
const void *A, int lda,
float *beta,
void *B, int ldb,
void* stream);
int HIP_csymm(
void* side, void* uplo,
int m, int n,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_csyr2k(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_csyrk(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
void *beta,
void *C, int ldc,
void* stream);
int HIP_ctrmm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
void *alpha,
const void *A, int lda,
void *B, int ldb,
void* stream);
int HIP_ctrsm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
void *alpha,
const void *A, int lda,
void *B, int ldb,
void* stream);
int HIP_dgemm(
void* transa, void* transb,
int m, int n, int k,
double *alpha,
const double *A, int lda,
const double *B, int ldb,
double *beta,
double *C, int ldc,
void* stream);
int HIP_dsymm(
void* side, void* uplo,
int m, int n,
double *alpha,
const double *A, int lda,
const double *B, int ldb,
double *beta,
double *C, int ldc,
void* stream);
int HIP_dsyr2k(
void* uplo, void* trans,
int n, int k,
double *alpha,
const double *A, int lda,
const double *B, int ldb,
double *beta,
double *C, int ldc,
void* stream);
int HIP_dsyrk(
void* uplo, void* trans,
int n, int k,
double *alpha,
const double *A, int lda,
double *beta,
double *B, int ldb,
void* stream);
int HIP_dtrmm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
double *alpha,
const double *A, int lda,
double *B, int ldb,
void* stream);
int HIP_dtrsm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
double *alpha,
const double *A, int lda,
double *B, int ldb,
void* stream);
int HIP_sgemm(
void* transa, void* transb,
int m, int n, int k,
float *alpha,
const float *A, int lda,
const float *B, int ldb,
float *beta,
float *C, int ldc,
void* stream);
int HIP_ssymm(
void* side, void* uplo,
int m, int n,
float *alpha,
const float *A, int lda,
const float *B, int ldb,
float *beta,
float *C, int ldc,
void* stream);
int HIP_ssyr2k(
void* uplo, void* trans,
int n, int k,
float *alpha,
const float *A, int lda,
const float *B, int ldb,
float *beta,
float *C, int ldc,
void* stream);
int HIP_ssyrk(
void* uplo, void* trans,
int n, int k,
float *alpha,
const float *A, int lda,
float *beta,
float *B, int ldb,
void* stream);
int HIP_strmm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
float *alpha,
const float *A, int lda,
float *B, int ldb,
void* stream);
int HIP_strsm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
float *alpha,
const float *A, int lda,
float *B, int ldb,
void* stream);
int HIP_zgemm(
void* transa, void* transb,
int m, int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_zhemm(
void* side, void* uplo,
int m, int n,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_zher2k(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
double *beta,
void *C, int ldc,
void* stream);
int HIP_zherk(
void* uplo, void* trans,
int n, int k,
double *alpha,
const void *A, int lda,
double *beta,
void *B, int ldb,
void* stream);
int HIP_zsymm(
void* side, void* uplo,
int m, int n,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_zsyr2k(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
const void *B, int ldb,
void *beta,
void *C, int ldc,
void* stream);
int HIP_zsyrk(
void* uplo, void* trans,
int n, int k,
void *alpha,
const void *A, int lda,
void *beta,
void *C, int ldc,
void* stream);
int HIP_ztrmm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
void *alpha,
const void *A, int lda,
void *B, int ldb,
void* stream);
int HIP_ztrsm(
void* side, void* uplo,
void* transa, void* diag,
int m, int n,
void *alpha,
const void *A, int lda,
void *B, int ldb,
void* stream);
END_MODULE
###
#
# @file CMakeLists.txt
#
# @copyright 2009-2014 The University of Tennessee and The University of
# Tennessee Research Foundation. All rights reserved.
# @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @project CHAMELEON
# CHAMELEON is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.2.0
# @author Florent Pruvost
# @author Mathieu Faverge
# @author Loris Lucido
# @date 2023-01-30
#
###
# Generate header files
# ---------------------
set(HIPBLAS_HDRS_GENERATED "")
set(ZHDR
hipblas/hipblas_z.h
)
precisions_rules_py(
HIPBLAS_HDRS_GENERATED "${ZHDR}"
TARGETDIR hipblas
PRECISIONS "s;d;c;z;zc;ds" )
# Define the list of headers
# --------------------------
set(HIPBLAS_HDRS
hipblas.h
)
# Add generated headers
# ---------------------
foreach( hdr_file ${HIPBLAS_HDRS_GENERATED} )
list(APPEND HIPBLAS_HDRS ${CMAKE_CURRENT_BINARY_DIR}/${hdr_file})
endforeach()
# Force generation of headers
# ---------------------------
add_custom_target(hipblas_include ALL SOURCES ${HIPBLAS_HDRS})
set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};hipblas_include" CACHE INTERNAL "List of targets of sources")
# Installation
# ------------
install( FILES hipblas.h
DESTINATION include )
install( FILES ${HIPBLAS_HDRS}
DESTINATION include/hipblas )
###
### END CMakeLists.txt
###
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment