-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '9-complex-gemm' into 'master'
Add complex gemm See merge request mutsuki/CULiP!11
- Loading branch information
Showing
5 changed files
with
127 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
cublasStatus_t CULIP_FUNC_NAME(cublasHandle_t handle, cublasOperation_t transa, | ||
cublasOperation_t transb, int m, int n, int k, | ||
const CULIP_TYPE *alpha, const CULIP_TYPE *A, int lda, | ||
const CULIP_TYPE *B, int ldb, const CULIP_TYPE *beta, CULIP_TYPE *C, | ||
int ldc) { | ||
const int profiling_flag = (CULiP_profiling_control_array[CULiP_cublasSgemm] == 0) && CULiP_is_profiling_enabled(CULIP_CUBLAS_DISABLE_ENV_NAME); | ||
|
||
// Get the function pointer | ||
cublasStatus_t (*cublas_lib_func)(cublasHandle_t, cublasOperation_t, cublasOperation_t, int, int, int, const CULIP_TYPE*, const CULIP_TYPE*, int, const CULIP_TYPE*, int, const CULIP_TYPE*, CULIP_TYPE*, int); | ||
*(void**)(&cublas_lib_func) = CULiP_get_function_pointer(CULIP_CUBLAS_LIBRARY_NAME, CULIP_CUBLAS_ENV_NAME, __func__, &CULiP_cublas_lib_handle_cache); | ||
|
||
cudaStream_t cuda_stream; | ||
struct CULiP_profile_result profile_result; | ||
|
||
if (profiling_flag) { | ||
// Get current cuda stream | ||
cublasGetStream(handle, &cuda_stream); | ||
|
||
// Profile result structure | ||
snprintf(profile_result.function_name, profile_result.function_name_length - 1, "%s-m%d-n%d-k%d", __func__, m, n ,k); | ||
|
||
// Record start rimestamp | ||
CULiP_launch_function(cuda_stream, &CULiP_record_timestamp, (void*)&profile_result.start_timestamp); | ||
} | ||
|
||
// Call the function | ||
const cublasStatus_t result = (*cublas_lib_func)(handle, transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc); | ||
CULIBPROFILER_DEBUG_PRINT(printf("[CULiP Debug][%s] executed\n", __func__)); | ||
|
||
if (profiling_flag) { | ||
// Record end rimestamp | ||
CULiP_launch_function(cuda_stream, &CULiP_record_timestamp, (void*)&profile_result.end_timestamp); | ||
|
||
// Print result | ||
CULiP_launch_function(cuda_stream, &CULiP_print_profile_result, (void*)&profile_result); | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters