Remove cublas dependency

This commit is contained in:
2024-03-05 18:41:35 +01:00
parent 98ad84c659
commit f4257afd5a
16 changed files with 65 additions and 141 deletions

View File

@@ -1,8 +1,6 @@
#ifndef CONV_LAYER_H
#define CONV_LAYER_H
#include <cublas_v2.h>
#include <string>
#include <vector>
@@ -19,8 +17,7 @@ class Conv2d {
int stride,
std::string padding,
int numFilters,
Activation activation,
cublasHandle_t cublasHandle
Activation activation
);
~Conv2d();
@@ -44,7 +41,6 @@ class Conv2d {
std::vector<float> kernels;
// Cuda
cublasHandle_t cublasHandle;
float* d_kernels;
float* d_padded;

View File

@@ -1,8 +1,6 @@
#ifndef DENSE_LAYER_H
#define DENSE_LAYER_H
#include <cublas_v2.h>
#include <functional>
#include <string>
#include <vector>
@@ -16,8 +14,7 @@ class Dense : public ILayer {
Dense(
int inputSize,
int outputSize,
Activation activation,
cublasHandle_t cublasHandle
Activation activation
);
~Dense();
@@ -29,8 +26,6 @@ class Dense : public ILayer {
int inputSize;
int outputSize;
cublasHandle_t cublasHandle;
float* d_weights;
float* d_biases;

View File

@@ -2,8 +2,6 @@
#ifndef I_LAYER_H
#define I_LAYER_H
#include <cublas_v2.h>
#include <vector>
namespace Layers {

View File

@@ -2,9 +2,6 @@
#define CUDA_HELPER_H
#include <cuda_runtime.h>
#include <cublas_v2.h>
#define IDX2C(i,j,ld) (((j)*(ld))+(i))
// CUDA error checking macro
#define CUDA_CHECK(call) \
@@ -18,15 +15,4 @@ do { \
} \
} while (0)
// cuBLAS error checking macro
#define CUBLAS_CHECK(call) \
do { \
cublasStatus_t result = call; \
if (result != CUBLAS_STATUS_SUCCESS) { \
fprintf(stderr, "cuBLAS error at %s:%d code=%d\n", \
__FILE__, __LINE__, static_cast<unsigned int>(result)); \
exit(EXIT_FAILURE); \
} \
} while (0)
#endif // CUDA_HELPER_H