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

  • SEARCH
  • Home
  • 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 8436799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:16:50+00:00 2026-06-10T07:16:50+00:00

I implemented a RNS Montgomery exponentiation in Cuda. Everything nice everything fine. It runs

  • 0

I implemented a RNS Montgomery exponentiation in Cuda.

Everything nice everything fine. It runs on just one SM.

BUT, so far I focus on parallelization of just a single exp. What I want to do now is test with several exp on fly. That is, I want that the i-th next exp is assign to a free SM.

I tried, and the final time was always growing linearly, that is all the exp were assign to the same SM.

Then I switched to streams, but nothing changed.

However I have never used them, so maybe I am doing something wrong..

This is the code:

void __smeWrapper() {
    cudaEvent_t start, stop;
    cudaStream_t stream0, stream1, stream2;
    float time;
    unsigned int j, i, tmp;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);
    dim3 threadsPerBlock(SET_SIZE, (SET_SIZE+1)/2);

    setCudaDevice();

    s_transferDataToGPU();

    if(cudaDeviceSetCacheConfig(cudaFuncCachePreferL1) != cudaSuccess)
        printf("cudaDeviceSetCacheConfig ERROR!");

    cudaEventRecord( start, 0 );

    //for(i=0; i<EXPONENTIATION_NUMBER; i++)    {
    i=0;
        __me<<< 1, threadsPerBlock, 0, stream0 >>>(&__s_x[i*(2*SET_SIZE + 1)],     __B2modN, __bases, __mmi_NinB, __mmi_Bimodbi, __Bi_inAUar, __dbg, __NinAUar,    
                                            __mmi_BinAUar, __mmi_Ajmodaj, __Ajmodar, __mmi_Armodar, __AjinB, __minusAinB, &__z[i*(2*SET_SIZE + 1)], __e);
    i=1;
        __me<<< 1, threadsPerBlock, 0, stream1 >>>(&__s_x[i*(2*SET_SIZE + 1)], __B2modN, __bases, __mmi_NinB, __mmi_Bimodbi, __Bi_inAUar, __dbg, __NinAUar,
                                        __mmi_BinAUar, __mmi_Ajmodaj, __Ajmodar, __mmi_Armodar, __AjinB, __minusAinB, &__z[i*(2*SET_SIZE + 1)], __e);
    i=2;
    __me<<< 1, threadsPerBlock, 0, stream2 >>>(&__s_x[i*(2*SET_SIZE + 1)], __B2modN, __bases, __mmi_NinB, __mmi_Bimodbi, __Bi_inAUar, __dbg, __NinAUar, __mmi_BinAUar,
                                                                    __mmi_Ajmodaj, __Ajmodar, __mmi_Armodar, __AjinB, __minusAinB, &__z[i*(2*SET_SIZE + 1)], __e);
        //printf("\n%s\n\n", cudaGetErrorString(cudaGetLastError()));
    //}

cudaEventRecord( stop, 0 );
cudaEventSynchronize( stop );
cudaEventElapsedTime( &time, start, stop );
    printf("GPU %f µs : %f ms\n", time*1000, time);

cudaEventDestroy( start );
cudaEventDestroy( stop );

Ubuntu 11.04 64b, Cuda 5 RC, 560 Ti (8 SM)

  • 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-10T07:16:52+00:00Added an answer on June 10, 2026 at 7:16 am

    All threads from a block always run on a same SM. You need to start more then one block to use other SMs.

    There seems to be something wrong with your streams – do you call cudaStreamCreate for every stream? On my system it crashes with SEGFAULT if I don’t use one though.

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

Sidebar

Related Questions

I implemented the Facebook registration on my website. Everything works fine except that suddenly
I implemented RestSharp succesfully in my WP7 application, but one issue remains: When I
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
We implemented In-app Billing one year ago with no problems following the sample code
I implemented sherlockactionbar in my project and it works great, but I don't know
I implemented a quick search in my application. But when I turned the screen,
I implemented the delegate-callback pattern between two classes without retaining the delegate. But in
I implemented a Zend project And its working fine Now i tried to implement
I implemented one custom workflow in in Visual Studio 2010 using CRM 2011 Developer
I implemented in my app MFMessageComposeViewController for send sms. It works well, but I

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.