NVIDIA / NVIDIA/cutlass

[BUG] undefined reference to `cutlass::library::Handle::~Handle()' collect2: error: ld returned 1 exit status

Open
#1,626 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage bug inactive-30d inactive-90d
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

Describe the bug
/usr/bin/ld: /tmp/tmpxft_0000b975_00000000-11_single_file.o: in function main': tmpxft_0000b975_00000000-6_single_file.cudafe1.cpp:(.text+0x594): undefined reference to cutlass::library::Handle::Handle(CUstream_st*, unsigned long)'
/usr/bin/ld: tmpxft_0000b975_00000000-6_single_file.cudafe1.cpp:(.text+0x627): undefined reference to cutlass::library::Handle::gemm(int, int, int, cutlass::library::NumericTypeID, cutlass::library::NumericTypeID, void const*, cutlass::library::NumericTypeID, cutlass::library::LayoutTypeID, cutlass::library::ComplexTransform, void const*, long, cutlass::library::NumericTypeID, cutlass::library::LayoutTypeID, cutlass::library::ComplexTransform, void const*, long, void const*, cutlass::library::NumericTypeID, void const*, long, void*, long)' /usr/bin/ld: tmpxft_0000b975_00000000-6_single_file.cudafe1.cpp:(.text+0x658): undefined reference to cutlass::library::Handle::~Handle()'
/usr/bin/ld: tmpxft_0000b975_00000000-6_single_file.cudafe1.cpp:(.text+0x6c4): undefined reference to `cutlass::library::Handle::~Handle()'
collect2: error: ld returned 1 exit status

Steps/Code to reproduce bug
#include "cutlass/library/library.h"
#include "cutlass/library/handle.h"

#include <cutlass/util/host_tensor.h>

int main() {

//
// Define the problem size
//
int M = 512;
int N = 256;
int K = 128;

float alpha = 1.25f;
float beta = -1.25f;

//
// Allocate device memory
//

cutlass::HostTensor<float, cutlass::layout::ColumnMajor> A({M, K});
cutlass::HostTensor<float, cutlass::layout::ColumnMajor> B({K, N});
cutlass::HostTensor<float, cutlass::layout::ColumnMajor> C({M, N});
cutlass::HostTensor<float, cutlass::layout::ColumnMajor> D({M, N});

float const *ptrA = A.device_data();
float const *ptrB = B.device_data();
float const *ptrC = C.device_data();
float *ptrD = C.device_data();

int lda = A.device_ref().stride(0);
int ldb = B.device_ref().stride(0);
int ldc = C.device_ref().stride(0);
int ldd = D.device_ref().stride(0);

//
// CUTLASS Library call to execute device GEMM
//

handle;

//
// Launch GEMM on CUDA device.
//

cutlass::Status status = handle.gemm(
M,
N,
K,

cutlass::library::NumericTypeID::kF32,          // data type of internal accumulation
cutlass::library::NumericTypeID::kF32,          // data type of alpha/beta scalars

&alpha,                                         // pointer to alpha scalar

cutlass::library::NumericTypeID::kF32,          // data type of A matrix
cutlass::library::LayoutTypeID::kColumnMajor,   // layout of A matrix
cutlass::library::ComplexTransform::kConjugate, 
ptrA,                                           // pointer to A matrix in device memory
lda,                                            // leading dimension of A matrix

cutlass::library::NumericTypeID::kF32,          // data type of B matrix
cutlass::library::LayoutTypeID::kColumnMajor,   // layout of B matrix
cutlass::library::ComplexTransform::kNone,
ptrB,                                           // pointer to B matrix in device memory
ldb,                                            // leading dimension of B matrix

&beta,                                          // pointer to beta scalar

cutlass::library::NumericTypeID::kF32,          // data type of C and D matrix

ptrC,                                           // pointer to C matrix in device memory
ldc,                                            // leading dimension fo C matrix

ptrD,                                           // pointer to D matrix in device memory
ldd                                             // leading dimension of D matrix

);

if (status != cutlass::Status::kSuccess) {
return -1;
}

return 0;
}
Expected behavior
When I was using the CUTLASS Library following the Quick Start documentation, I encountered this problem when compiling its examples as instructed

Environment details (please complete the following information):
compiler-args " -I/content/cutlass/include -I/content/cutlass/tools/library/include -I/content/cutlass/tools/util/include --expt-relaxed-constexpr"

Additional context
I looked up the information and found that there was a problem in the linking process, but I don't know how to solve it. Could you please help me

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CUTLASS Quick Start documentation and the listed library.h, handle.h, and compiler arguments. Reproduce the linker failure, then verify the documented build and link steps resolve the Handle constructor, gemm, and destructor symbols.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.