gpt4 book ai didi

cuda - GPU 仿真器,无需硬件即可进行 CUDA 编程

转载 作者:行者123 更新时间:2023-12-03 04:43:56 25 4
gpt4 key购买 nike

问题:是否有适用于 Geforce 卡的模拟器,可以让我在没有实际硬件的情况下编程和测试 CUDA?

<小时/>

信息:

我希望加快 CUDA 中的一些模拟速度,但我的问题是我并不总是在桌面周围进行此开发。我想在我的上网本上做一些工作,但我的上网本没有 GPU。现在据我所知,您需要一个支持 CUDA 的 GPU 才能运行 CUDA。有办法解决这个问题吗?似乎唯一的方法是 GPU 模拟器(这显然会非常慢,但可以工作)。但无论有什么方法可以做到这一点,我都想听听。

我正在 Ubuntu 10.04 LTS 上编程。

最佳答案

对于那些在 2016 年(甚至 2017 年)寻求答案的人......

<小时/>

免责声明

  • 我终究没能模拟 GPU。
  • 如果您满足其列表,则可以使用 gpuocelot依赖关系。

我尝试为 BunsenLabs 获取模拟器(Linux 3.16.0-4-686-pae #1 SMPDebian 3.16.7-ckt20-1+deb8u4 (2016-02-29) i686 GNU/Linux)。

我会告诉你我学到了什么。

<小时/>
  1. nvcc 曾经在 CUDA Toolkit 3.0 中具有 -deviceemu 选项

    我下载了 CUDA Toolkit 3.0,安装了它并尝试运行一个简单的程序:

    #include <stdio.h>

    __global__ void helloWorld() {
    printf("Hello world! I am %d (Warp %d) from %d.\n",
    threadIdx.x, threadIdx.x / warpSize, blockIdx.x);
    }

    int main() {
    int blocks, threads;
    scanf("%d%d", &blocks, &threads);
    helloWorld<<<blocks, threads>>>();
    cudaDeviceSynchronize();
    return 0;
    }

    请注意,在 CUDA Toolkit 3.0 中,nvcc 位于 /usr/local/cuda/bin/ 中。

    事实证明我在编译时遇到了困难:

    NOTE: device emulation mode is deprecated in this release
    and will be removed in a future release.

    /usr/include/i386-linux-gnu/bits/byteswap.h(47): error: identifier "__builtin_bswap32" is undefined

    /usr/include/i386-linux-gnu/bits/byteswap.h(111): error: identifier "__builtin_bswap64" is undefined

    /home/user/Downloads/helloworld.cu(12): error: identifier "cudaDeviceSynchronize" is undefined

    3 errors detected in the compilation of "/tmp/tmpxft_000011c2_00000000-4_helloworld.cpp1.ii".

    我在互联网上发现,如果我使用 gcc-4.2 或类似的古老版本而不是 gcc-4.9.2,错误可能会消失。我放弃了。


  2. gpuocelot

    Stringer 的答案有一个非常古老的 gpuocelot 项目网站的链接。所以一开始我以为这个项目在2012年左右就被放弃了。事实上,几年后它就被废弃了。

    以下是一些最新网站:

    我尝试按照 the guide 安装 gpuocelot 。但我在安装过程中遇到了一些错误,我再次放弃了。 gpuocelot 不再受支持,并且依赖于一组非常特定版本的库和软件。

    您可以尝试关注this tutorial从 2015 年 7 月开始,但我不保证它会起作用。我没有测试过。


  3. MCUDA

    The MCUDA translation framework is a linux-based tool designed to effectively compile the CUDA programming model to a CPU architecture.

    这可能有用。这是a link to the website .


  4. CUDA 浪费

    它是一个在 Windows 7 和 8 上使用的模拟器。不过我还没有尝试过。它似乎不再被开发(最后一次提交日期为 2013 年 7 月 4 日)。

    以下是该项目网站的链接:https://code.google.com/archive/p/cuda-waste/

<小时/>
  • CU2CL

    最后更新:2017 年 3 月 12 日

    dashesy评论中指出,CU2CL似乎是一个有趣的项目。它似乎能够将 CUDA 代码转换为 OpenCL 代码。因此,如果您的 GPU 能够运行 OpenCL 代码,那么您可能会对 CU2CL 项目感兴趣。

    链接:

  • 关于cuda - GPU 仿真器,无需硬件即可进行 CUDA 编程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3087361/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com