我正在尝试通过命令提示符在Windows 7上编译cuda测试程序,我是这个命令:
nvcc test.cu
Run Code Online (Sandbox Code Playgroud)
但我得到的只是这个错误:
nvcc fatal : Cannot find compiler 'cl.exe' in PATH
Run Code Online (Sandbox Code Playgroud)
可能导致此错误的原因是什么?
我在尝试编译项目时遇到以下错误:( fortran,使用gfortran)
未定义的引用`omp_get_max_threads_'
未定义的引用`omp_get_thread_num_'
问题是,我的GCC版本是4.4.3,这是为了支持OpenMP.
我在尝试编译CUDA程序时收到以下消息:
/ usr/bin/ld:找不到-lcudart
从来没有遇到过这种错误.我的PATH有问题吗?
这是编译命令:
gfortran -g -O2 -ffree-line-length-none -I ../ shared/-o ../../bin/xspecfem3D ../../obj/spec/program_specfem3D.o ../../ obj/spec/specfem3D_par.o ../../obj/spec/PML_init.o ../../obj/spec/compute_boundary_kernel.o ../../obj/spec/compute_kernels.o ../. ./obj/spec/compute_forces_acoustic.o ../../obj/spec/compute_forces_acoustic_pot.o ../../obj/spec/compute_forces_acoustic_PML.o ../../obj/spec/compute_forces_elastic.o .. /../obj/spec/compute_forces_elastic_Dev.o ../../obj/spec/compute_forces_elastic_noDev.o ../../obj/spec/compute_forces_elastic_Dev_openmp.o ../../obj/spec/compute_add_sources_acoustic.o ../../obj/spec/compute_add_sources_elastic.o ../../obj/spec/compute_coupling_acoustic_el.o ../../obj/spec/compute_coupling_elastic_ac.o ../../obj/spec/compute_stacey_acoustic .o ../../obj/spec/compute_stacey_elastic.o ../../obj/spec/compute_gradient.o ../../obj/spec/compute_interpolated_dva.o ../../obj/spec /initialize_simulation.o ../../obj/spec/read_mesh_databases.o ../../obj/spec/setup_GLL_point 所以../../obj/spec/write_movie_output.o ../../obj/spec/create_color_image.o ../../obj/spec/write_seismograms.o ../../obj/spec/ write_output_ASCII.o ../../obj/spec/detect_mesh_surfaces.o ../../obj/spec/setup_movie_meshes.o ../../obj/spec/read_topography_bathymetry.o ../../obj/ spec/setup_sources_receivers.o ../../obj/spec/prepare_timerun.o ../../obj/spec/iterate_time.o ../../obj/spec/finalize_simulation.o ../../ obj/spec/save_adjoint_kernels.o ../../obj/spec/specfem3D.o ../../obj/spec/assemble_MPI_vector.o ../../obj/spec/make_gravity.o ../. ./obj/spec/noise_tomography.o ../../lib/libspecfem.a ../../obj/spec/check_fields_cuda.cuda.o ../../obj/spec/compute_add_sources_acoustic_cuda.cuda.o ../../obj/spec/compute_add_sources_elastic_cuda.cuda.o ../../obj/spec/compute_coupling_cuda.cuda.o ../../obj/spec/compute_forces_acoustic_cuda.cuda.o ../ .. /obj/spec/compute_forces_elastic_cuda.cuda.o ../../obj/spec/compute_kernels_cuda.cuda.o ../../obj/spec/compute_stacey_acoustic_cuda.cuda.o ../../obj/spec/ compute_stacey_elastic_cuda.cuda.o ../../obj/spec/it_update_displacement_cuda.cuda.o ../../obj/spec/noise_tomography_cuda.cuda.o ../../obj/spec/prepare_mesh_constants_cuda.cuda.o ../../obj/spec/transfer_fields_cuda.cuda.o ../../obj/spec/write_seismograms_cuda.cuda.o ../../obj/spec/save_and_compare_cpu_vs_gpu.cudacc.o …
我的下面的代码出现错误,当它运行时,一些图形权重被覆盖,但不应该发生Xa数组(它保留了哪些已被访问过)和__syncthreads()函数... May有人帮忙吗?
struct Node
{
int begin; // begining of the substring
int num; // size of the sub-string
};
__global__ void BFS (Node *Va, int *Ea, bool *Fa, bool *Xa, int *Ca, bool *parada)
{
int tid = threadIdx.x;
if (Fa[tid] == true && Xa[tid] == false)
{
Fa[tid] = false;
__syncthreads();
// Va begin is where it's edges' subarray begins, Va is it's
// number of elements
for (int i = Va[tid].begin; i < (Va[tid].begin + Va[tid].num); i++) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用指针在memmory上分配一个矩阵,但我一直收到错误消息:
| 122 |错误:从'void*'到'int**'|的无效转换
| 124 |错误:从'void*'到'int*'|的无效转换
这是我的代码,我看不出我做错了什么...这个"void*"转换对我来说没有意义......
int i,j;
int **a;
int c = 2;
/* Form the matrix */
a = malloc((nxy+1)*sizeof(int *));
for (i=0;i<=nxy;i++)
a[i] = malloc((nxy+1)*sizeof(int));
for (i=0;i<=nxy;i++)
for (j=0;j<=nxy;j++)
a[i][j] = 0;
Run Code Online (Sandbox Code Playgroud) 我需要将一些命令行的示例放入 LaTeX 文件中,但每次我尝试使用某些字符(例如_)时,都会收到“!Missing $ insert”错误。
我如何编写字符串,例如:
./configure FC=gfortran --with-cuda --without-mpi FLAGS_CHECK="-g -O2" FLAGS_NO_CHECK="-g -O2 -ffree-line-length-none -I../shared/ -L/usr/local/cuda/lib64 -fopenmp"
Run Code Online (Sandbox Code Playgroud)
无需使用$... $?(我不希望它看起来像数学表达式。)
如果我尝试向我的CUDA设备发送一个比可用内存大的结构,那么CUDA会给我任何警告或错误吗?
我问这是因为我的GPU有1024 MBytes(1073414144字节)全局内存总量,但我不知道应该如何处理和最终的问题.
那是我的代码:
#define VECSIZE 2250000
#define WIDTH 1500
#define HEIGHT 1500
// Matrices are stored in row-major order:
// M(row, col) = *(M.elements + row * M.width + col)
struct Matrix
{
int width;
int height;
int* elements;
};
int main()
{
Matrix M;
M.width = WIDTH;
M.height = HEIGHT;
M.elements = (int *) calloc(VECSIZE,sizeof(int));
int row, col;
// define Matrix M
// Matrix generator:
for (int i = 0; i < M.height; i++)
for(int j = 0; …Run Code Online (Sandbox Code Playgroud)