es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: CUDA-ARRAYS

Preguntas sobre la macro CUDA __CUDA_ARCH__

Tengo un código simple de CUDA en ttt.cu. “`c++ #include <iostream> <strong>global</strong> void example(){ printf("CUDA_ARCH: %d \n", <strong>CUDA_ARCH</strong>); } int main(){ example<<<1,1>>>(); } <pre><code>con CMakeLists.txt: </code></pre> cmake_minimum_required(VERSION 3.18) project(Hello) find_package(CUDA REQUIRED) cuda_add_executable(sss ttt.cu) “` Luego obtengo el error: el identificador “__CUDA_ARCH__” no está definido. Me gustaría saber por qué ocurre . . . Read more

Uso de memoria constante CUDA en múltiples archivos fuente mostrando diferentes comportamientos en cuda-11.2 y cuda-11.4.

Mínimo reproducible: kernel.cu: <h1>#include <stdio.h></h1> <p><strong>constant</strong> int N_GPU;</p> <p>void wrapper_fn(int *ptr) { cudaMemcpyToSymbol(N_GPU, ptr, sizeof(int), cudaMemcpyDeviceToDevice); }</p> <p><strong>global</strong> void printKernel() {</p> <pre><code>printf(“N = %d; \n”, N_GPU); </code></pre> <p>} <code> driver.cu: </code>c</p> <h1>#include “cuda_runtime.h”</h1> <h1>#include <stdio.h></h1> <p>void wrapper_fn(int*); <strong>global</strong> void printKernel();</p> <p>int main() { int N = 10; int* d_N_ptr; cudaMalloc(&d_N_ptr, . . . Read more