我正在尝试打印我已使用的线程数(在我的代码中声明)以及我正在创建的块数。它们的类型为:dim3(我正在使用 C 编程。)
我的代码看起来像下面这样:
//Declared a NxN grid
*int N = 4; //Num of rows
int numThreads = 4;
dim3 dimBlock(numThreads);
dim3 dimGrid((N/dimBlock.x)+(!(N%dimBlock.x)?0:1));
Run Code Online (Sandbox Code Playgroud)
您能帮我了解如何在终端上打印此信息吗?使用 printf,要使用哪个说明符;就像我们使用 %d 表示 int,%f 表示 float 等。
cuda ×1