0

我想在另一个仓库中外部使用 FAISS C++ GPU。因此,我创建了一个 hello.cpp 并尝试在不进入 faiss 目录的情况下对其进行编译。在 faiss 目录中,编译对我来说似乎很好。

  • hello.cpp(C++ Faiss GPU):
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <random>
#include <sys/time.h>
#include <faiss/gpu/GpuIndexIVFPQ.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/gpu/GpuCloner.h>
#include <faiss/utils/random.h> 
#include <fstream> 
#include <faiss/gpu/utils/DeviceUtils.h>
#include <faiss/gpu/utils/Timer.h>
#include <string>
#include <iostream>
#include <faiss/gpu/GpuAutoTune.h>
#include <faiss/index_io.h>
using namespace std;

double elapsed() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return tv.tv_sec + tv.tv_usec * 1e-6;
}
int main() {
    double t0 = elapsed();
    printf("[%.3f s] Hello World! :))\n",
           elapsed() - t0);
    faiss::gpu::StandardGpuResources res; // Without this line, nvcc works.

    return 0;
}

命令:

/usr/local/cuda/bin/nvcc /home/hossamamer/hello.cpp -lcublas -lfaiss -o myCublasApp

输出:

/usr/bin/ld: warning: libmkl_intel_lp64.so, needed by /usr/local/lib/libfaiss.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libmkl_gnu_thread.so, needed by /usr/local/lib/libfaiss.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libmkl_core.so, needed by /usr/local/lib/libfaiss.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `dgemm_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `dgetri_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `dgetrf_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `ssyrk_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgetrf_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgelsd_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgemm_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `dgesvd_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `dsyev_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgeqrf_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sorgqr_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgesvd_'
/usr/bin/ld: /usr/local/lib/libfaiss.so: undefined reference to `sgetri_'
collect2: error: ld returned 1 exit status

有什么帮助吗?我也可以使用 make 命令执行此操作吗?命令是什么?

4

0 回答 0