Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:18:05+00:00 2026-06-13T23:18:05+00:00

I am working in parallelise [this file][1] on GPU using [PTX file with matlab

  • 0

I am working in parallelise [this file][1] on GPU using [PTX file with matlab parallel.gpu.CUDAkernel][2]. My problem with [kron tensor product][3] is the following. My code should multiply two vectors kron(a,b) by multiplying each element of the first vector a=<32x1> by the all elements of the other vector b=<1x32> and the output vector size will be k<32x32>=a.*b. I tried to write it in C++ and it worked, as I only concern about summing all the elements of 2d array. I thought I can make it easy as 1D array because m=sum(sum(kron(a,b))) is the code I am working on

for(i=0;i<32;i++)
 for(j=0;j<32;j++)
   k[i*32+j]=a[i]*b[j]

It meant to have the a[i]th element multiply by eachelement in b and I though to go with 32 blocks with each block has a 32 threads and the code should be

__global__ void myKrom(int* c,int* a, int*b) {
  int i=blockDim.x*blockIdx.x+threadIdx.x;
  while(i<32) {
    c[i]=a[blockIdx.x]+b[blockDim.x*blockIdx.x+threadIdx.x];
  }

That should make the trick as the blockIdx.x is the outer loop, but it didn’t. Could any body tell me where, may i ask for parallel way to do the parallel sum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:18:05+00:00Added an answer on June 13, 2026 at 11:18 pm

    You may actually mean something like this:

    __global__ void myKrom(int* c,int* a, int*b)
    {
      int i=blockDim.x*blockIdx.x+threadIdx.x;
      if(i<32*32){
        c[i]=a[blockIdx.x]+b[threadIdx.x];
      }
    
    }
    

    when you call the kernel by myKrom<<<32, 32>>> (c, a, b);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project where we need to parallelize this problem using
Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with H2 I get this error when I try to write a row
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
I'm very new to Scala! However, I have the following working solution to Euler
There are a couple of articles on this, and I have this working...but I
So I've been working with parallel collections in Scala for a graph project I'm
I have a C++ program which is working quite well using OpenMP to parallelize
I'm working on .Net project (windows service) and I found memory leak. Using ANTS
I'm writing a downloader in C# and stopped at the following problem: what kind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.