Tag: CUDA-ARRAYS
#include void loop(void) { int smid = -1; if (threadIdx.x == 0) { asm volatile(“mov.u32 %0, %%smid;”: “=r”(smid)); printf(“smid: %d\n”, smid); } while (1); } int main() { loop<<<1, 32>>>(); cudaDeviceSynchronize(); return 0; } “` Este es mi código fuente, el kernel imprime smid cuando el índice del hilo es . . . Read more
Tengo el siguiente código de cmake y cuda para generar una arquitectura cuda 750, sin embargo, esto siempre resulta en un CUDAARCH = 300 (2080 ti con cuda 10.1). Intenté tanto set_property como target_compile_options, pero ambos fallaron. ¿Tenemos una solución para cuda_add_executable y cuda_add_library en este caso para que la . . . Read more
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
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
import math # todas las bibliotecas que importo import numpy as np !pip install pycuda import pycuda.gpuarray as gpu import pycuda.cumath as cm import pycuda.autoinit import pycuda.driver as drv from pycuda.compiler import SourceModule Tengo un error que se produce después de usar GPUarrays de PyCUDA con un bucle for. Definí . . . Read more