未定义对cusolverDn的引用 [英] undefined reference to cusolverDn

查看:112
本文介绍了未定义对cusolverDn的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行cuda 7.0中可用的cuSolver库.我在使用cuSolver库时遇到了一个问题,该问题必须非常容易修复,但是在这里我需要一些帮助.

I am trying to run the cuSolver library available in cuda 7.0. I have an issue with using the cuSolver library that must be very simple to fix, but here I am asking for some help.

我看了很多发布的示例,我特别从JackOLantern中选择了一个示例:

I have looked at quite a few examples posted around and I chose in particular this one from JackOLantern:

使用CUDA并行实现多个SVD

我刚刚将其简化为kernel_0.cu:

I have just reduced it to a 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.我将其编译为(明确的):

I use the same Utilities.cuh and Utilities.cu as JackOlantern. I compile it as (to be explicit):

/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,它可以很好地编译,因此显然包含了很好的库.

If I comment out the cusolverDnCreate and cusolverDnDestroy, it compiles fine, so the library is apparently well included.

我缺少什么简单而基本的要点?我已经搜索过了,但是无法解决.谢谢你.

What simple and basic point am I missing? I have searched around, but I could not fix it. Thanks there.

推荐答案

我缺少什么简单而基本的要点?

What simple and basic point am I missing?

您必须链接到cusolver库:

You have to link against the cusolver library:

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

这篇关于未定义对cusolverDn的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆