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 回答