void DNATranslatorImpl<T, max_threads>::cleanup() { if(dna_seq_host != NULL) { delete dna_seq_host; dna_seq_host = NULL; } if(rna_seq_host != NULL) { delete rna_seq_host; rna_seq_host = NULL; } if(aa_seq_host != NULL) { delete aa_seq_host; aa_seq_host = NULL; } if(dna_seq_device != NULL) { CUDA_CHECK_RETURN(cudaFree(dna_seq_device)); dna_seq_device = NULL; } if(rna_seq_device != NULL) { CUDA_CHECK_RETURN(cudaFree(rna_seq_device)); rna_seq_device = NULL; } if(aa_seq_device != NULL) { CUDA_CHECK_RETURN(cudaFree(aa_seq_device)); aa_seq_device = NULL; } }
void AdjMatrix<double>::floyd() { cuTimer T; T.logstart(); cuFloyd_D(cuMat,dim); T.logstop(); CUDA_CHECK_RETURN(cudaGetLastError()); T.logtime(); std::cout<<T.gettime()<<std::endl; CUDA_CHECK_RETURN(cudaGetLastError()); }
void ElasticVectorAddition::initKernel() { int* A_host = (int*) malloc(sizeof(int) * this->numElems); int* B_host = (int*) malloc(sizeof(int) * this->numElems); srand(2); for (int var = 0; var < this->numElems; ++var) { A_host[var] = rand(); B_host[var] = rand(); } CUDA_CHECK_RETURN(cudaMalloc(&a, sizeof(int) * this->numElems)); CUDA_CHECK_RETURN(cudaMalloc(&b, sizeof(int) * this->numElems)); CUDA_CHECK_RETURN(cudaMemcpy(a, A_host, sizeof(int) * this->numElems, cudaMemcpyHostToDevice)); CUDA_CHECK_RETURN(cudaMemcpy(b, B_host, sizeof(int) * this->numElems, cudaMemcpyHostToDevice)); free(A_host); free(B_host); }
void AdjMatrix<double>::fill() { cuFill_D(cuMat,dim); CUDA_CHECK_RETURN(cudaGetLastError()); }
void AdjMatrix<int>::fill() { cuFill_I(cuMat,dim); CUDA_CHECK_RETURN(cudaGetLastError()); }
void ElasticVectorAddition::freeResources() { CUDA_CHECK_RETURN(cudaFree(this->a)); CUDA_CHECK_RETURN(cudaFree(this->b)); }
void DNATranslatorImpl<T, max_threads>::load_aa_seq_from_gpu() { if(aa_seq_device != NULL) { aa_seq_host = new T[aa_seq_size]; CUDA_CHECK_RETURN(cudaMemcpy(aa_seq_host, aa_seq_device, aa_seq_size * sizeof(T), cudaMemcpyDeviceToHost)); } }
void DNATranslatorImpl<T, max_threads>::load_rna_seq_from_gpu() { if(rna_seq_device != NULL) { rna_seq_host = new T[multiple_3_size]; CUDA_CHECK_RETURN(cudaMemcpy(rna_seq_host, rna_seq_device, size * sizeof(T), cudaMemcpyDeviceToHost)); } }
void DNATranslatorImpl<T, max_threads>::load_dna_seq_on_gpu() { CudaUtils::malloc_on_gpu<T>((void**) &dna_seq_device, multiple_3_size, debug); CUDA_CHECK_RETURN(cudaMemcpy(dna_seq_device, dna_seq_host, multiple_3_size * sizeof(T), cudaMemcpyHostToDevice)); }