Skip to content

Commit

Permalink
Adding export definitions to hipblas header (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent Knox authored May 2, 2017
1 parent 879726b commit 37ab62b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 49 deletions.
4 changes: 2 additions & 2 deletions cmake/build-version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro( project_version )
endif( )
if( POLICY CMP0048 )
cmake_policy( SET CMP0048 NEW )
project( ${PV_NAME} VERSION 0.1.0.0 LANGUAGES ${PV_LANGUAGES} )
project( ${PV_NAME} VERSION 0.2.0.0 LANGUAGES ${PV_LANGUAGES} )

else( )
project( ${PV_NAME} ${PV_LANGUAGES} )
Expand All @@ -29,7 +29,7 @@ macro( project_version )
endif( )

if( NOT DEFINED ${PV_NAME}_VERSION_MINOR )
set( ${PV_NAME}_VERSION_MINOR 1 )
set( ${PV_NAME}_VERSION_MINOR 2 )
endif( )

if( NOT DEFINED ${PV_NAME}_VERSION_PATCH )
Expand Down
80 changes: 41 additions & 39 deletions library/include/hipblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! HIP = Heterogeneous-compute Interface for Portability
//!
//! Define a extremely thin runtime layer that allows source code to be compiled unmodified
//! Define a extremely thin runtime layer that allows source code to be compiled unmodified
//! through either AMD HCC or NVCC. Key features tend to be in the spirit
//! and terminology of CUDA, but with a portable path to other accelerators as well.
//!
Expand All @@ -14,6 +14,8 @@
#define HIPBLAS_H
#pragma once
#include <hip/hip_runtime_api.h>
#include "hipblas-export.h"
#include "hipblas-version.h"

typedef void * hipblasHandle_t;

Expand All @@ -27,7 +29,7 @@ enum hipblasStatus_t {
HIPBLAS_STATUS_INTERNAL_ERROR, // an internal HIPBLAS operation failed
HIPBLAS_STATUS_NOT_SUPPORTED // function not implemented
};

enum hipblasOperation_t {
HIPBLAS_OP_N,
HIPBLAS_OP_T,
Expand All @@ -38,86 +40,86 @@ enum hipblasOperation_t {
extern "C" {
#endif

hipblasStatus_t hipblasCreate(hipblasHandle_t* handle);
HIPBLAS_EXPORT hipblasStatus_t hipblasCreate(hipblasHandle_t* handle);

hipblasStatus_t hipblasDestroy(hipblasHandle_t handle);
HIPBLAS_EXPORT hipblasStatus_t hipblasDestroy(hipblasHandle_t handle);

hipblasStatus_t hipblasSetStream(hipblasHandle_t handle, hipStream_t streamId);
HIPBLAS_EXPORT hipblasStatus_t hipblasSetStream(hipblasHandle_t handle, hipStream_t streamId);

hipblasStatus_t hipblasGetStream(hipblasHandle_t handle, hipStream_t *streamId);
HIPBLAS_EXPORT hipblasStatus_t hipblasGetStream(hipblasHandle_t handle, hipStream_t *streamId);

hipblasStatus_t hipblasSetVector(int n, int elemSize, const void *x, int incx, void *y, int incy);
HIPBLAS_EXPORT hipblasStatus_t hipblasSetVector(int n, int elemSize, const void *x, int incx, void *y, int incy);

hipblasStatus_t hipblasGetVector(int n, int elemSize, const void *x, int incx, void *y, int incy);
HIPBLAS_EXPORT hipblasStatus_t hipblasGetVector(int n, int elemSize, const void *x, int incx, void *y, int incy);

hipblasStatus_t hipblasSetMatrix(int rows, int cols, int elemSize, const void *A, int lda, void *B, int ldb);
HIPBLAS_EXPORT hipblasStatus_t hipblasSetMatrix(int rows, int cols, int elemSize, const void *A, int lda, void *B, int ldb);

hipblasStatus_t hipblasGetMatrix(int rows, int cols, int elemSize, const void *A, int lda, void *B, int ldb);
HIPBLAS_EXPORT hipblasStatus_t hipblasGetMatrix(int rows, int cols, int elemSize, const void *A, int lda, void *B, int ldb);

hipblasStatus_t hipblasSasum(hipblasHandle_t handle, int n, const float *x, int incx, float *result);
HIPBLAS_EXPORT hipblasStatus_t hipblasSasum(hipblasHandle_t handle, int n, const float *x, int incx, float *result);

hipblasStatus_t hipblasDasum(hipblasHandle_t handle, int n, const double *x, int incx, double *result);
HIPBLAS_EXPORT hipblasStatus_t hipblasDasum(hipblasHandle_t handle, int n, const double *x, int incx, double *result);

hipblasStatus_t hipblasSasumBatched(hipblasHandle_t handle, int n, float *x, int incx, float *result, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasSasumBatched(hipblasHandle_t handle, int n, float *x, int incx, float *result, int batchCount);

hipblasStatus_t hipblasDasumBatched(hipblasHandle_t handle, int n, double *x, int incx, double *result, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasDasumBatched(hipblasHandle_t handle, int n, double *x, int incx, double *result, int batchCount);

hipblasStatus_t hipblasSaxpy(hipblasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy);
HIPBLAS_EXPORT hipblasStatus_t hipblasSaxpy(hipblasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy);

hipblasStatus_t hipblasDaxpy(hipblasHandle_t handle, int n, const double *alpha, const double *x, int incx, double *y, int incy) ;
HIPBLAS_EXPORT hipblasStatus_t hipblasDaxpy(hipblasHandle_t handle, int n, const double *alpha, const double *x, int incx, double *y, int incy) ;

hipblasStatus_t hipblasSaxpyBatched(hipblasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasSaxpyBatched(hipblasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy, int batchCount);

hipblasStatus_t hipblasScopy(hipblasHandle_t handle, int n, const float *x, int incx, float *y, int incy);
HIPBLAS_EXPORT hipblasStatus_t hipblasScopy(hipblasHandle_t handle, int n, const float *x, int incx, float *y, int incy);

hipblasStatus_t hipblasDcopy(hipblasHandle_t handle, int n, const double *x, int incx, double *y, int incy);
HIPBLAS_EXPORT hipblasStatus_t hipblasDcopy(hipblasHandle_t handle, int n, const double *x, int incx, double *y, int incy);

hipblasStatus_t hipblasScopyBatched(hipblasHandle_t handle, int n, const float *x, int incx, float *y, int incy, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasScopyBatched(hipblasHandle_t handle, int n, const float *x, int incx, float *y, int incy, int batchCount);

hipblasStatus_t hipblasDcopyBatched(hipblasHandle_t handle, int n, const double *x, int incx, double *y, int incy, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasDcopyBatched(hipblasHandle_t handle, int n, const double *x, int incx, double *y, int incy, int batchCount);


hipblasStatus_t hipblasSdot (hipblasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result);
HIPBLAS_EXPORT hipblasStatus_t hipblasSdot (hipblasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result);

hipblasStatus_t hipblasDdot (hipblasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result);
HIPBLAS_EXPORT hipblasStatus_t hipblasDdot (hipblasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result);

hipblasStatus_t hipblasSdotBatched (hipblasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasSdotBatched (hipblasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result, int batchCount);

hipblasStatus_t hipblasDdotBatched (hipblasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasDdotBatched (hipblasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result, int batchCount);

hipblasStatus_t hipblasSscal(hipblasHandle_t handle, int n, const float *alpha, float *x, int incx);
HIPBLAS_EXPORT hipblasStatus_t hipblasSscal(hipblasHandle_t handle, int n, const float *alpha, float *x, int incx);

hipblasStatus_t hipblasDscal(hipblasHandle_t handle, int n, const double *alpha, double *x, int incx);
HIPBLAS_EXPORT hipblasStatus_t hipblasDscal(hipblasHandle_t handle, int n, const double *alpha, double *x, int incx);

/* not implementes, requires complex support
hipblasStatus_t hipblasCscal(hipblasHandle_t handle, int n, const hipComplex *alpha, hipComplex *x, int incx);
hipblasStatus_t hipblasZscal(hipblasHandle_t handle, int n, const hipDoubleComplex *alpha, hipDoubleComplex *x, int incx);
*/

hipblasStatus_t hipblasSscalBatched(hipblasHandle_t handle, int n, const float *alpha, float *x, int incx, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasSscalBatched(hipblasHandle_t handle, int n, const float *alpha, float *x, int incx, int batchCount);

hipblasStatus_t hipblasDscalBatched(hipblasHandle_t handle, int n, const double *alpha, double *x, int incx, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasDscalBatched(hipblasHandle_t handle, int n, const double *alpha, double *x, int incx, int batchCount);

hipblasStatus_t hipblasSgemv(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const float *alpha, const float *A, int lda,
HIPBLAS_EXPORT hipblasStatus_t hipblasSgemv(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const float *alpha, const float *A, int lda,
const float *x, int incx, const float *beta, float *y, int incy);

hipblasStatus_t hipblasDgemv(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const double *alpha, const double *A, int lda,
HIPBLAS_EXPORT hipblasStatus_t hipblasDgemv(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const double *alpha, const double *A, int lda,
const double *x, int incx, const double *beta, double *y, int incy);

hipblasStatus_t hipblasSgemvBatched(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const float *alpha, float *A, int lda,
HIPBLAS_EXPORT hipblasStatus_t hipblasSgemvBatched(hipblasHandle_t handle, hipblasOperation_t trans, int m, int n, const float *alpha, float *A, int lda,
float *x, int incx, const float *beta, float *y, int incy, int batchCount);

hipblasStatus_t hipblasSger(hipblasHandle_t handle, int m, int n, const float *alpha, const float *x, int incx, const float *y, int incy, float *A, int lda);
HIPBLAS_EXPORT hipblasStatus_t hipblasSger(hipblasHandle_t handle, int m, int n, const float *alpha, const float *x, int incx, const float *y, int incy, float *A, int lda);

hipblasStatus_t hipblasDger(hipblasHandle_t handle, int m, int n, const double *alpha, const double *x, int incx, const double *y, int incy, double *A, int lda);
HIPBLAS_EXPORT hipblasStatus_t hipblasDger(hipblasHandle_t handle, int m, int n, const double *alpha, const double *x, int incx, const double *y, int incy, double *A, int lda);

hipblasStatus_t hipblasSgerBatched(hipblasHandle_t handle, int m, int n, const float *alpha, const float *x, int incx, const float *y, int incy, float *A, int lda, int batchCount);
HIPBLAS_EXPORT hipblasStatus_t hipblasSgerBatched(hipblasHandle_t handle, int m, int n, const float *alpha, const float *x, int incx, const float *y, int incy, float *A, int lda, int batchCount);

hipblasStatus_t hipblasSgemm(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
HIPBLAS_EXPORT hipblasStatus_t hipblasSgemm(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
int m, int n, int k, const float *alpha, const float *A, int lda, const float *B, int ldb, const float *beta, float *C, int ldc);

hipblasStatus_t hipblasDgemm(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
HIPBLAS_EXPORT hipblasStatus_t hipblasDgemm(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
int m, int n, int k, const double *alpha, const double *A, int lda, const double *B, int ldb, const double *beta, double *C, int ldc);

/* not implementes, requires complex support
Expand All @@ -131,10 +133,10 @@ hipblasStatus_t hipblasHgemm(hipblasHandle_t handle, hipblasOperation_t transa,
int m, int n, int k, const __half *alpha, __half *A, int lda, __half *B, int ldb, const __half *beta, __half *C, int ldc);
*/

hipblasStatus_t hipblasSgemmBatched(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
HIPBLAS_EXPORT hipblasStatus_t hipblasSgemmBatched(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
int m, int n, int k, const float *alpha, const float *A[], int lda, const float *B[], int ldb, const float *beta, float *C[], int ldc, int batchCount);

hipblasStatus_t hipblasDgemmBatched(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
HIPBLAS_EXPORT hipblasStatus_t hipblasDgemmBatched(hipblasHandle_t handle, hipblasOperation_t transa, hipblasOperation_t transb,
int m, int n, int k, const double *alpha, const double *A[], int lda, const double *B[], int ldb, const double *beta, double *C[], int ldc, int batchCount);

/* not implementes, requires complex support
Expand Down
22 changes: 14 additions & 8 deletions library/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@ elseif (${PLATFORM} MATCHES "nvcc")

endif()

set_target_properties( hipblas PROPERTIES VERSION ${hipblas_VERSION} SOVERSION ${hipblas_SOVERSION} )

install(TARGETS hipblas
EXPORT hipblas-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
target_include_directories( hipblas
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)

set_target_properties( hipblas PROPERTIES VERSION ${hipblas_VERSION} SOVERSION ${hipblas_SOVERSION} )

# Package that helps me set visibility for function names exported from shared library
include( GenerateExportHeader )
if( CMAKE_VERSION VERSION_LESS "3.0" )
Expand All @@ -93,6 +91,14 @@ else()
endif( )
GENERATE_EXPORT_HEADER( hipblas EXPORT_FILE_NAME hipblas-export.h )

install(TARGETS hipblas
EXPORT hipblas-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
)

# The following is cmake code to generate a config file package for hipblas
# Documentation for how to use the following package:
# https://cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html
Expand Down

0 comments on commit 37ab62b

Please sign in to comment.