CUDA - 如果我选择了太多的块? [英] CUDA - what if I choose too many blocks?

查看:111
本文介绍了CUDA - 如果我选择了太多的块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这些未知大小的矩阵仍然很生气,每个维度可能有10-20.000之间的变化。

I'm still getting mad on these unknown-size matrices which may vary from 10-20.000 for each dimension.

我在看CUDA sdk和

I'm looking at the CUDA sdk and wondering: what if I choose a number of blocks too high?

如果我的硬件具有SMs,那么在X和Y维度上就像一个9999 x 9999块的网格不能保存所有这些块,内核是否会有问题或性能会崩溃?

Something like a grid of 9999 x 9999 blocks in the X and Y dimensions, if my hardware has SMs which can't hold all these blocks, will the kernel have problems or the performances would simply collapse?

我不知道如何在块/线程维度可能变化这么多..我想使用MAXIMUM块我的硬件支持,然后使线程内部的所有矩阵,这是正确的方法?

I don't know how to dimension in blocks/threads something which may vary so much.. I'm thinking at using the MAXIMUM number of blocks my hardware supports and then making the threads inside them work across all the matrix, is this the right way?

推荐答案

线程块没有与核心的一对一映射。块被调度到核心,因为它们变得可用,这意味着您可以请求尽可能多的(可能达到极限)。

The thread blocks do not have a one to one mapping with the cores. Blocks are scheduled to cores as they become available, meaning you can request as many as you want (up to a limit probably). Requesting a huge number of blocks would just slow the system down as it loads and unloads do-nothing thread blocks to the cores.

您可以指定网格的尺寸,并且可以指定网格的尺寸。

You can specify the dimensions of the grid and blocks at run time.

编辑:以下是文档中网格和块的尺寸限制。

Here are the limits on the dimensions of the grid and the blocks, from the documentation.

>

这篇关于CUDA - 如果我选择了太多的块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆