c++ - `Error using mex Supported compiler not detected` : can't install a CUDA-compatible C++ compiler for MATLAB

标签 c++ matlab cuda

我有 Matlab 2022b、Windows 11。在 Matlab 中 mex -setup cpp 产量

MEX configured to use 'Microsoft Visual C++ 2022' for C++ language compilation

在命令提示符处,nvcc --version 产生:

   nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2022 NVIDIA Corporation
    Built on Mon_Oct_24_19:40:05_Pacific_Daylight_Time_2022
    Cuda compilation tools, release 12.0, V12.0.76
    Build cuda_12.0.r12.0/compiler.31968024_0

当我尝试运行 this file 时,我收到此错误:

 Error using mex
    Supported compiler not detected. For options, visit https://www.mathworks.com/support/compilers.
    
    Error in mexcuda (line 168)
        [varargout{1:nargout}] = mex(mexArguments{:});
    
    Error in mexGPUall (line 7)
        mexcuda -largeArrayDims spikedetector3.cu

在 Matlab 中选择“MinGW64 Compiler (C++)”会出现相同的错误。

我找到了this thread 。至少有一名参与者正在尝试运行与我相同的应用程序 Kilosort。我尝试下载并安装 Visual Studio 2019。完成后,mex -setup cpp 并没有为我提供比以前更多的 C++ 编译器选项。

有谁知道如何安装一个编译器来执行该文件并运行 Kilosort?

最佳答案

MATLAB 曾经有一个 very stringent GPU-hardware/CUDA toolkit/MATLAB version compatibility requirement一直到小数点后的数字。

您可能需要检查the version of Visual Studio you install is compatible with your version of CUDA.仅仅让所有内容保持最新是不够的。

但是,自 R2022 以来,Mathworks 对此一直含糊其辞。 我想您可以使用较早的版本以及经过测试可以正常工作的发行版本的特定组合(我们遵循该表并让 Kilosort 启动并运行),或者尝试对较新版本进行一些变体。

如果您成功了,还请分享您的工具链配置,以便其他人可以从您的经验中受益。 .

关于c++ - `Error using mex Supported compiler not detected` : can't install a CUDA-compatible C++ compiler for MATLAB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74923983/

相关文章:

c++ - 成员方法如何删除对象?

c++ - X()、Y() 和 Z() 宏在 LLVM 中有什么作用?

c++ - 优化代码/实现 "for"循环而不是长 "if - else if - else"

python - Python 中的 Matlab freqz 函数

matlab - 如何创建采样值矩阵

cuda - 在 centos 6.2 上设置 cuda 5.0

c - 尝试消除共轭梯度内核中的 cudaDeviceSynchronize()

c++ - 使用二维线程在CUDA中添加两个矩阵

c++ - 如何初始化字符串的std::array?

matlab - 以编程方式打开 Simulink MATLAB 功能 block 的代码