-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpuResidualFunction.h
More file actions
34 lines (25 loc) · 973 Bytes
/
Copy pathgpuResidualFunction.h
File metadata and controls
34 lines (25 loc) · 973 Bytes
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
28
29
30
31
32
33
34
#pragma once
#include <cublas_v2.h>
#include <cuda_runtime.h>
#include "solver/residualFunction.h"
#include "solver/gpu/gpuResidualBlock.h"
namespace telef::solver {
class GPUResidualFunction : public ResidualFunction {
public:
using Ptr = std::shared_ptr<GPUResidualFunction>;
using ConstPtr = std::shared_ptr<const GPUResidualFunction>;
GPUResidualFunction(CostFunction::Ptr costFunc_,
GPUResidualBlock::Ptr resBlock_,
const float weight_= 1.0)
: ResidualFunction(costFunc_, resBlock_, weight_), lossScale_d(nullptr) {}
virtual ~GPUResidualFunction();
void setCublasHandle(cublasHandle_t cublasHandle_){
cublasHandle = cublasHandle_;
}
void setLossFunction(LossFunction::Ptr loss) override;
void applyLoss() override;
protected:
cublasHandle_t cublasHandle;
float* lossScale_d;
};
}