난 (대략 70메가바이트 임)는 다음과 같이 부동 소수점 숫자의 17,338,896 요소를 할당하려고. 이것은 컴퓨터에서 사용할 수있는 비디오 카드 메모리의 양 (광산에서 128MB)과 관련이 있거나 이것이 cublasAlloc() 함수를 사용하여 할당 할 수있는 메모리 양의 한계가 될 수 있습니까? 컴퓨터에서 사용할 수있는 메모리 용량)? 나는 cudaMalloc() 함수를 사용하여 시도하고 같은 문제가 실행되고있다. 이것을 조사해 주셔서 미리 감사드립니다.CUBLAS 메모리 할당 에러
-------------- 오류 복제 추가 ----------------------------- ---------
#include <cuda.h>
#include <stdio.h>
int main (int argc, char *argv[]) {
// CUDA setup
cublasStatus state;
if(cublasInit() == CUBLAS_STATUS_NOT_INITIALIZED) {
printf("CUBLAS init error.\n");
return -1;
}
// Instantiate video memory pointers
float *K0cuda;
// Allocate video memory needed
state = cublasAlloc(20000000,
sizeof(float),
(void**)&K0cuda);
if(state != CUBLAS_STATUS_SUCCESS) {
printf("Error allocation video memory.\n");
return -1;
}
// Copy K0 from CPU memory to GPU memory
// Note: before so, decide whether to integrate as a part of InsertionSim or
// CUDA content as a separate class
//state = cublasSetMatrix(theSim->Ndim, theSim->Ndim, sizeof(*theSim->K0),
// theSim->K0, theSim->Ndim, K0cuda, theSim->Ndim);
//if(state != CUBLAS_STATUS_SUCCESS) {
// printf("Error copy to video memory.\n");
// return -1;
//}
// Free memory
if(cublasFree(K0cuda) != CUBLAS_STATUS_SUCCESS) {
printf("Error freeing video memory.\n");
return -1;
}
// CUDA shutdown
if(cublasShutdown() != CUBLAS_STATUS_SUCCESS) {
printf("CUBLAS shutdown error.\n");
return -1;
}
if(theSim != NULL) delete theSim;
return 0;
}
이것은 프로그램의 첫 번째 VRAM 할당입니까? cudaMalloc()을 사용하여 문제없이 메모리 블록을 할당했습니다. 최소한의 재현 만 제공 할 수 있을까요? – Gabriel
예, 그렇습니다. 최소 재생산을 위해 무엇을보고 싶습니까? – stanigator
최소 재생산은 오류를 생성하는 가장 작은 완전한 프로그램입니다. 필요한 것 이상으로, C 파일로 복사/붙여 넣기, 컴파일, 링크 및 실행할 수있는 것이 이상적입니다. 귀하의 설명을 감안할 때, 그것은 C의 몇 라인 이상이어야합니다. – Gabriel