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 8284347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:04:32+00:00 2026-06-08T11:04:32+00:00

My program uses the CUDA Radix Sort Class. After an update from CUDA 4.0

  • 0

My program uses the CUDA Radix Sort Class. After an update from CUDA 4.0 to 4.2 a class auxiliary init function is crashing with the message “Stack around the variable ‘devprop’ was corrupted”. I have isolated the problem commenting some function code and found that cudaGetDeviceProperties is corrupting devprop. I just don’t know why this is happening and how to fix the problem. My setup is CUDA 4.2, dev driver 301.32, Nsight 2.2, Windows 7 64 bits, compiling for Win32. The following snippet has the crashing initDeviceParameters() auxiliary function:

namespace nvRadixSort
{
#include "radixsort.h"
#include "cudpp/cudpp.h"
#include <stdio.h>
#include <assert.h>

bool bManualCoalesce = false;
bool bUsePersistentCTAs = false;

void initDeviceParameters(bool keysOnly)
{
    int deviceID = -1;
    if(cudaSuccess == cudaGetDevice(&deviceID))
    {
        cudaDeviceProp devprop;
        cudaGetDeviceProperties(&devprop, deviceID);

        int smVersion = devprop.major * 10 + devprop.minor;

        // sm_12 and later devices don't need help with coalesce in reorderData kernel
        bManualCoalesce = (smVersion < 12);
        bUsePersistentCTAs = (smVersion < 20);

        if(bUsePersistentCTAs)
        {
            //Irrelevant. My setup is 2.1
        }
    }
}
}

And this is the relevant class code:

#include <cuda_runtime_api.h>
#include "cudpp/cudpp.h"

namespace nvRadixSort
{

class RadixSort
{
    public:

    RadixSort(unsigned int maxElements, bool keysOnly = false)
        : mScanPlan(0),
          mNumElements(0),
          mTempKeys(0),
          mTempValues(0),
          mCounters(0),
          mCountersSum(0),
          mBlockOffsets(0)
    {
        // Allocate temporary storage
        initialize(maxElements, keysOnly);
    }
    protected: // data

    CUDPPHandle   mCudppContext;
    CUDPPHandle   mScanPlan;        // CUDPP plan handle for prefix sum

    unsigned int  mNumElements;     // Number of elements of temp storage allocated
    unsigned int *mTempKeys;        // Intermediate storage for keys
    unsigned int *mTempValues;      // Intermediate storage for values
    unsigned int *mCounters;        // Counter for each radix
    unsigned int *mCountersSum;     // Prefix sum of radix counters
    unsigned int *mBlockOffsets;    // Global offsets of each radix in each block

    protected: // methods

    void initialize(unsigned int numElements, bool keysOnly)
    {
        // initialize parameters based on present CUDA device
        initDeviceParameters(keysOnly);

        // Allocate temporary storage
        mNumElements = numElements;

        unsigned int numBlocks = ((numElements % (CTA_SIZE * 4)) == 0) ?
                                 (numElements / (CTA_SIZE * 4)) : (numElements / (CTA_SIZE * 4) + 1);
        unsigned int numBlocks2 = ((numElements % (CTA_SIZE * 2)) == 0) ?
                                  (numElements / (CTA_SIZE * 2)) : (numElements / (CTA_SIZE * 2) + 1);

        // Initialize scan
        cudppCreate(&mCudppContext);

        CUDPPConfiguration scanConfig;
        scanConfig.algorithm = CUDPP_SCAN;
        scanConfig.datatype  = CUDPP_UINT;
        scanConfig.op        = CUDPP_ADD;
        scanConfig.options   = CUDPP_OPTION_EXCLUSIVE | CUDPP_OPTION_FORWARD;
        cudppPlan(mCudppContext , &mScanPlan, scanConfig, 16 * numBlocks2, 1, 0);

        cudaMalloc((void **)&mTempKeys,     numElements * sizeof(unsigned int));
        if(!keysOnly)
            cudaMalloc((void **)&mTempValues,   numElements * sizeof(unsigned int));
        cudaMalloc((void **)&mCounters,     WARP_SIZE_ * numBlocks * sizeof(unsigned int));
        cudaMalloc((void **)&mCountersSum,  WARP_SIZE_ * numBlocks * sizeof(unsigned int));
        cudaMalloc((void **)&mBlockOffsets, WARP_SIZE_ * numBlocks * sizeof(unsigned int));

        checkCudaError("RadixSort::initialize()");
    }
}
  • 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-08T11:04:33+00:00Added an answer on June 8, 2026 at 11:04 am

    Solved the problem. It was that my Visual Studio project still using CUDA 4.0 build rules and tools even with CUDA 4.2 version available. Just changed the project file to use the new files and that did the trick.

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

Sidebar

Related Questions

I'm having problems compiling a CUDA program that uses GLUT on MacOsX. Here is
A part of my program uses WinInet's caching function (e.g. FindFirstUrlCacheEntry, FindNextUrlCacheEntry) to go
The following program uses an inner class named Anonymous which itself extends its enclosing
My Program uses EF to access data from a SQL CE database. When debug
I've got a program that uses a few CUDA kernels and this one is
My program uses wx.ProgressDialog to give feedback on a process that is in multiple
My program uses some external programs that i included in the Files folder. In
My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved
If my Perl program uses Perl modules, how will it determine where to find
My C# program uses a web browser control and I programmatically set its html

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.