1

cuda 7.0 で利用可能な cuSolver ライブラリを実行しようとしています。cuSolver ライブラリの使用に関して問題があり、修正が非常に簡単である必要がありますが、ここで助けを求めています。

投稿されたかなりの数の例を見てきましたが、特にJackOLanternからこれを選びました:

CUDA を使用した複数の SVD の並列実装

それをkernel_0.cuに減らしました:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include<iostream>
#include<iomanip>
#include<stdlib.h>
#include<stdio.h>
#include<assert.h> 
#include<math.h>

#include <cusolverDn.h>
#include <cuda_runtime_api.h>

#include "Utilities.cuh"

/********/
/* MAIN */
/********/
int main(){

// --- gesvd only supports Nrows >= Ncols
// --- column major memory ordering

// --- cuSOLVE input/output parameters/arrays
int *devInfo;           gpuErrchk(cudaMalloc(&devInfo,          sizeof(int)));

// --- CUDA solver initialization
cusolverDnHandle_t solver_handle;
cusolverDnCreate(&solver_handle);

cusolverDnDestroy(solver_handle);

return 0;

}

JackOlantern と同じ Utilities.cuh と Utilities.cu を使用します。私はそれを(明示的に)次のようにコンパイルします:

/usr/local/cuda-7.0/bin/nvcc kernel_0.cu Utilities.cu

そして、私が得るものは次のとおりです。

Utilities.cu(27): warning: conversion from a string literal to "char *" is deprecated

Utilities.cu(27): warning: conversion from a string literal to "char *" is deprecated

/tmp/tmpxft_00007e1d_00000000-22_kernel_0.o: In function `main':
tmpxft_00007e1d_00000000-4_kernel_0.cudafe1.cpp:(.text+0x3d): undefined     reference to `cusolverDnCreate'
tmpxft_00007e1d_00000000-4_kernel_0.cudafe1.cpp:(.text+0x49): undefined   reference to `cusolverDnDestroy'
collect2: error: ld returned 1 exit status

cusolverDnCreate と cusolverDnDestroy をコメント アウトすると、問題なくコンパイルされるため、ライブラリが適切に含まれているようです。

欠けている単純で基本的なポイントは何ですか? いろいろ調べましたが、直りませんでした。ありがとうございます。

4

1 に答える 1

4

欠けている単純で基本的なポイントは何ですか?

cusolver ライブラリにリンクする必要があります。

/usr/local/cuda-7.0/bin/nvcc kernel_0.cu Utilities.cu -lcusolver
于 2015-03-26T19:44:47.580 に答える