cudablas.h 2.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/**
 *
 * @copyright (c) 2009-2014 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
 *                          All rights reserved.
 * @copyright (c) 2012-2015 Inria. All rights reserved.
 * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 *
 **/

/**
 *
 * @file cudablas.h
 *
 *  MORSE cudablas headers
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver,
 *  and INRIA Bordeaux Sud-Ouest
 *
 * @author Florent Pruvost
 * @date 2015-09-16
 * @precisions normal z -> c d s
 *
 **/
#ifndef _CUDA_BLAS_H_
#define _CUDA_BLAS_H_

28 29
#include "include/chameleon_config.h"

30 31 32 33
#if !defined(CHAMELEON_USE_CUDA)
#error "This file should not be included"
#endif

34 35 36
#include <stdio.h>
#include <math.h>
#include <string.h>
37
#include <assert.h>
38 39 40

#include <cuda.h>
#include <cuComplex.h>
41

42
#if defined(CHAMELEON_USE_CUBLAS_V2)
43

44
#include <cublas_v2.h>
45 46 47 48 49 50 51 52 53
#define CUBLAS_STREAM_PARAM cublasHandle_t handle
#define CUBLAS_STREAM_VALUE handle
#define CUBLAS_HANDLE handle,
#define CUBLAS_SADDR(_a_) (&(_a_))
#define CUBLAS_VALUE(_a_) (_a_)
#define CUBLAS_GET_STREAM                       \
    cudaStream_t stream;                        \
    cublasGetStream( handle, &stream )

54
#else
55

56
#include <cublas.h>
57 58 59 60 61 62 63 64 65
#define CUBLAS_STREAM_PARAM cudaStream_t stream
#define CUBLAS_STREAM_VALUE stream
#define CUBLAS_HANDLE
#define CUBLAS_SADDR(_a_) (_a_)
#define CUBLAS_VALUE(_a_) (*(_a_))
#define CUBLAS_GET_STREAM

#endif /* defined(CHAMELEON_USE_CUBLAS_V2) */

66 67 68 69 70 71 72 73 74 75
#if defined(CHAMELEON_USE_MAGMA)
#include <magma.h>
#endif

/** ****************************************************************************
 * MORSE types and constants
 **/
#include "morse_types.h"
#include "morse_struct.h"
#include "morse_constants.h"
76 77 78
//#include "control/auxiliary.h"
//#include "control/descriptor.h"
//#include "control/tile.h"
79

80 81 82 83 84 85 86
/** ****************************************************************************
 * CUDA BLAS headers
 **/
#include "cudablas/include/cudablas_z.h"
#include "cudablas/include/cudablas_d.h"
#include "cudablas/include/cudablas_c.h"
#include "cudablas/include/cudablas_s.h"
87

88 89 90 91 92
/** ****************************************************************************
 * Coreblas Error
 **/
#define cudablas_error(k, str) fprintf(stderr, "%s: Parameter %d / %s\n", __func__, k, str)

93 94 95 96 97 98 99
/** ****************************************************************************
 *  LAPACK Constants
 **/
extern char *morse_lapack_constants[];
#define morse_lapack_const(morse_const) morse_lapack_constants[morse_const][0]

#endif