Do more. Code less. Free software for GPU computing.
<scroll to top>

sparse.h

Go to the documentation of this file.
00001 #ifndef __AF_SPARSE_H
00002 #define __AF_SPARSE_H
00003 
00004 #include "cusparse.h"
00005 #include <af/array.h>
00006 #include "af/exception.h"
00007 
00008 // HACK: get global versions of these
00009 extern "C" afError  af_cusparse_handle(cusparseHandle_t*);
00010 extern "C" afError  af_cusparse_mat(cusparseMatDescr_t*);
00011 extern af::array sparse_mul_core(const af::array& A, const af::array& B);
00012 extern af::array sparse_transpose(af::array& in);
00013 const char *cusparseGetErrorString(cusparseStatus_t);
00014 
00015 #define CUSPARSE_(call)                                                 \
00016     do {                                                                \
00017         cusparseStatus_t _e;                                            \
00018         if ((_e=(call)) == CUSPARSE_STATUS_SUCCESS) break;              \
00019         MSG("CUSPARSE runtime error: %s", cusparseGetErrorString(_e));  \
00020         return af_err(AF_ERR_EXTERN, "Cusparse failure");                \
00021     } while (0)
00022 #define CUSPARSE(call)   CUSPARSE_(call)
00023 
00024 
00025 #define CUSPARSE_THROW(call)                                            \
00026     do {                                                                \
00027         cusparseStatus_t _e;                                            \
00028         if ((_e=(call)) == CUSPARSE_STATUS_SUCCESS) break;              \
00029         MSG("CUSPARSE runtime error: %s", cusparseGetErrorString(_e));  \
00030         afError e =  af_err(AF_ERR_EXTERN, "Cusparse failure");         \
00031         AF_THROW(e);                                                    \
00032     } while (0)
00033 
00034 
00035 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines