Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orcuda: working on submatrices #43

Open
coti opened this issue Oct 27, 2021 · 0 comments
Open

orcuda: working on submatrices #43

coti opened this issue Oct 27, 2021 · 0 comments

Comments

@coti
Copy link
Collaborator

coti commented Oct 27, 2021

Hello,

I have a 2D matrix of size M*LDA and I want to work on a submatrix of size M*N.

My matrix is declared as follows:

    decl static complex_double A[M*LDA] = random;

and my loop is:

  for(i=0; i<=m-1; i++)
    for(j=0; j<=n-1; j++) {
        A[i*lda+j] *= alpha;
      }

The generated code allocates an area of size M*LDA and copies all the memory from the host to the device (when we are using a single stream), which is good:

  cudaMalloc(&dev_A,M *LDA*sizeof(complex_double));
  cudaMemcpy(dev_A,A,M *LDA*sizeof(complex_double),cudaMemcpyHostToDevice);

However, the generated kernel does not pass this size parameter, although it is using:

__global__ void orcu_kernel161(const int n, const int m, double alpha, complex_double* A) {
  const int tid=blockIdx.x*blockDim.x+threadIdx.x;
  const int gsize=gridDim.x*blockDim.x;
  int j;
  for (int i=tid; i<=m-1; i+=gsize) {
    for (j=0; j<=n-1; j++ ) {
      A[i*lda+j]=A[i*lda+j]*alpha;
    }
  }
}

Therefore, the code cannot compile.

My reproducer and some generated code are attached.

repro_submat_complex.c.txt
__orio_perftest1.cu.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant