memcpy上未指定的启动失败
#define ITER_BETWEEN_SAVES 10000#define TOTAL_ITER 10000#define ROOM_X 2048#define ROOM_Y 2048#define SOURCE_DIM_X 200#define SOURCE_DIM_Y 1000#define ALPHA 1.11e-4#define DELTA_T 10#define H 0.1#include <stdio.h>void Matrix(float* M);void SolverCPU(float* M1, float* M2);__global__ void SolverGPU(float* M1, float* M2);
#include "solver.h"#include<cuda.h>void Matrix(float* M){ for (int j = 0; j < SOURCE_DIM_Y; ++j) { for (int i = 0; i < SOURCE_DIM_X; ++i) { M[(i+(ROOM_X/2 - SOURCE_DIM_X/2)) + ROOM_X * (j+(ROOM_Y/2 - SOURCE_DIM_Y/2))] = 100; } }} __global__ void SolverGPU(float* M1,float *M2) { int i =threadIdx.x + blockIdx.x * blockDim.x; int j = threadIdx.y + blockIdx.y * blockDim.y; float M1_Index = M1[i + ROOM_X * j]; float M1_IndexUp = M1[i+1 + ROOM_X * j]; float M1_IndexDown =M1[i-1 + ROOM_X * j]; float M1_IndexLeft = M1[i + ROOM_X * (j+1)]; float M1_IndexRight = M1[i + ROOM_X *(j-1)]; M2[i + ROOM_X * j] = M1_Index + (ALPHA * DELTA_T / (H*H)) * (M1_IndexUp + M1_IndexDown + M1_IndexLeft +M1_IndexRight - 4*M1_Index); }