我通过NuGet 添加了对CUDAfy.NET库的引用.
<package id="CUDAfy.NET" version="1.12.4695.21111" targetFramework="net45" />
Run Code Online (Sandbox Code Playgroud)
当我运行我的程序时,我点击了Win32Exception:
该系统找不到指定的文件
这发生在程序的第一个实际行上:
CudafyModule km = CudafyTranslator.Cudafy();
Run Code Online (Sandbox Code Playgroud)
异常对象没有指示他们正在尝试加载哪个文件.
我怎样才能解决这个问题?
编辑
在使用.NET 4.0在VS2010中运行Codeplex下载的捆绑示例时,我看到了同样的异常.
Strack trace是:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Cudafy.CudafyModule.Compile(eGPUCompiler mode, Boolean deleteGeneratedCode)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Version cudaVersion, Boolean compile, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy()
Run Code Online (Sandbox Code Playgroud) 我想知道nvidia是否支持spir后端?如果是的话,我找不到任何关于它的文件和示例.但如果没有,有没有办法将spir后端工作到nvidia gpus上?提前致谢
这是一个很长的镜头,如果您认为问题太局部化,请投票结束.我搜索了caffe2 github存储库,打开了一个问题同样的问题,在caffe2_ccp_tutorials存储库中打开了另一个问题,因为它的作者似乎最了解它,阅读caffe2 :: Tensor和caffe2 :: CUDAContext上的doxygen文档,甚至通过caffe2 源代码,特别是tensor.h,context_gpu.h和context_gpu.cc.
我知道目前caffe2不允许将设备内存复制到张量.我愿意扩展库并执行拉取请求以实现此目的.我背后的原因是我使用cv::cuda::*在设备内存上运行的方法进行所有图像预处理,因此我认为在gpu上进行预处理显然是一个问题,只是将结果下载到主机上,然后让它从主机重新上传到网络.
看看Tensor<Context>我的构造函数,我可以看到
template<class SrcContext , class ContextForCopy >
Tensor (const Tensor< SrcContext > &src, ContextForCopy *context)
Run Code Online (Sandbox Code Playgroud)
可能会实现我想要的,但我不知道如何设置<ContextForCopy>然后用它来构建.
此外,我看到我可以用正确的尺寸构造Tensor,然后可以使用
template <typename T>
T* mutable_data()
Run Code Online (Sandbox Code Playgroud)
我可以分配/复制数据.数据本身存储在std::vector<cv::cuda::GpuMat,因此我将不得不迭代它,然后使用cuda::PtrStepSz或cuda::PtrStep访问底层设备分配的数据.这是我需要复制/分配到的相同数据caffe2::Tensor<CUDAContext>.
我一直试图找出内部Tensor<CPUContext>被复制的内容,Tensor<CUDAContext>因为我已经看过它的例子,但我无法弄明白,尽管我认为使用的方法是CopyFrom.如上所述的常见示例,从CPU复制到GPU:
TensorCPU tensor_cpu(...);
TensorCUDA tensor_cuda = workspace.CreateBlob("input")->GetMutable<TensorCUDA>();
tensor_cuda->ResizeLike(tensor_cpu); …Run Code Online (Sandbox Code Playgroud) I use the Tensorflow v 1.14.0. I work on Windows 10. And here is how relevant environment variables look in the PATH:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Users\sinthes\AppData\Local\Programs\Python\Python37
C:\Users\sinthes\AppData\Local\Programs\Python\Python37\Scripts
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\cuda\bin
Run Code Online (Sandbox Code Playgroud)
Maybe also worth to mention, just in case it might be relevant.. I use Sublime Text 3 for development and I do not use Anaconda. I find it a bit cumbersome to …
我正在尝试使用 CUDA 作为 opencv-4.1.1 中提供的 dnn 模块的后端,我构建了启用 CUDA 的 opencv,nvidia 驱动程序和 CUDA 正确放置在系统上,这里使用 manjaro 作为开发平台。
我正在尝试使用 cv2.dnn 模块加载预训练的 YOLOv3 权重,
net = cv2.dnn.readNetFromDarknet('yolov3.cfg', 'yolov3.weights')
Run Code Online (Sandbox Code Playgroud)
但它使用 CPU 作为默认推理引擎,但我试图使用 GPU 作为后端 IE,来自官方 opencv 文档,我发现以下
DNN_TARGET_CPU
DNN_TARGET_OPENCL
DNN_TARGET_OPENCL_FP16
DNN_TARGET_MYRIAD
DNN_TARGET_FPGA
Run Code Online (Sandbox Code Playgroud)
作为目标后端,但不支持直接 GPU 推理,所以如果不使用 GPU 作为底层推理引擎,用 CUDA 编译 opencv 有什么意义,
为了确保进程在 GPU 上运行,我发布了输出
nvidia-smi,
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.26 Driver Version: 430.26 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage …Run Code Online (Sandbox Code Playgroud) 我尝试在 GPU 支持(GTX 1660 SUPER)下运行 Tensorflow。
我使用 anaconda 创建了一个环境,然后安装了cudatoolkit(版本11.0.221)和tensorflow-gpu(版本2.4.1)。之后,我下载了cuDNN(版本8.0.4),并将所有文件从 cuDNN 的bin文件夹复制到我的环境的 bin 文件夹(位于 )anaconda3\envs\<env name>\Library\bin。在我的脚本中,我使用 来设置 GPU 内存的内存限制tf.config.experimental.set_memory_growth。
当我运行脚本(使用卷积算法)时,我收到一条警告,指出Couldn't invoke ptxas.exe --version出现错误后出现的情况Call to CreateProcess failed. Error code: 2。启动失败后,我得到:Relying on driver to perform ptx compilation. Modify $PATH to customize ptxas location.
我已经尝试切换到 cuDNN 版本8.1.1。
我该如何解决这个问题?
我正在manylinux2014_x86_64为 python 库构建一些预编译的 Linux 轮子,该库充当涉及 CUDA 的 C++ 库的 API。我使用 创建轮子pip wheel,然后运行auditwheel repair以在轮子中包含外部库(我的 C++ 库、pybind11 等)
问题是它想要将 CUDA 运行时和驱动程序库打包到轮子中。理想情况下,我希望将 CUDA 安装留给用户,而不是必须将其包含在 python 轮中(我什至不确定它的可再发行性如何)。
有谁知道一种将 cuda 库列入黑名单的方法吗auditwheel repair?或者也许还有另一种更好的方法?
已经在链接中显示了
https://dri.freedesktop.org/wiki/IntelPerformanceTuning/
第 2 步:CPU 与 GPU
如果 CPU % 超过 90,则应用程序正在 CPU 中运行。
在配置 ffmpeg 时,我启用了 opencl。ffmpeg 配置是,
ffmpeg version ebe0fa0 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
configuration: --enable-gpl --enable-libx264 --enable-opencl --enable-nonfree --enable-libmfx --enable-libmp3lame --enable-libaacplus
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. …Run Code Online (Sandbox Code Playgroud) 我有TypeError: expected torch.LongTensor (got torch.cuda.FloatTensor).
我如何转换torch.cuda.FloatTensor为torch.LongTensor?
Traceback (most recent call last):
File "train_v2.py", line 110, in <module>
main()
File "train_v2.py", line 81, in main
model.update(batch)
File "/home/Desktop/squad_vteam/src/model.py", line 131, in update
loss_adv = self.adversarial_loss(batch, loss, self.network.lexicon_encoder.embedding.weight, y)
File "/home/Desktop/squad_vteam/src/model.py", line 94, in adversarial_loss
adv_embedding = torch.LongTensor(adv_embedding)
TypeError: expected torch.LongTensor (got torch.cuda.FloatTensor)
Run Code Online (Sandbox Code Playgroud) >>> import tensorflow as tf
2020-07-08 17:10:50.005569: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>> tf.config.list_physical_devices('GPU')
2020-07-08 17:10:55.657489: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1050 computeCapability: 6.1
coreClock: 1.493GHz coreCount: 5 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 104.43GiB/s
2020-07-08 17:10:55.701387: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
Run Code Online (Sandbox Code Playgroud)
in [1]: import tensorflow as tf
tf.config.list_physical_devices('GPU')
out[1]: []
in [1]: tf.__version__
out[1]: '2.2.0'
Run Code Online (Sandbox Code Playgroud)