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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:38:07+00:00 2026-06-16T04:38:07+00:00

I want to partition a large data set and split the work on multiple

  • 0

I want to partition a large data set and split the work on multiple GPUs. I want to make these data static so that I don’t have to load to GPU for the second run. Now the problem is that, pthread_create requires all input data be assembled into a “struct”, and I am not sure whether assembling a bunch of static data into a struct will work. Thanks for any suggestions.

  • 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-16T04:38:09+00:00Added an answer on June 16, 2026 at 4:38 am

    In “modern” CUDA multi-gpu, it is no longer necessary to use a different host thread to hold a context on a given device. Since CUDA 4.0, the API is thread safe, and one host thread can hold and work with multiple contexts simply using cudaSetDevice.

    A really, really basic example of how to distribute a large dataset over multiple GPUs in CUDA 4.x or CUDA 5 could be as simple as:

    int remainder = N;
    int* plens = new int[ngpus];
    float** pvals = new float*[ngpus];
    float* source = &host_array[0];
    for(int i=0; i<ngpus; i++) {
        const int blen = N/gpus;
        plens[i] = blen;
        remainder -= blen;
        if (remainder < blen) {
            plens[i] += remaninder;
            remainder = 0;
        }
        size_t sz = sizeof(float) * size_t(plens[i]);
        cudaSetDevice(i);
        cudaMalloc((void **)&pvals[i], sz);
        cudaMemcpy(pvals[i], source, sz, cudaMemcpyHostToDevice);
        source += plens[i];
    }
    

    [disclaimer: written in browser, never compiled or tested, use a own risk]

    assuming that the GPUs are sequentially numbered from [0,ngpus-1] and the source data is held in the floating point array host_array of length N. You get back an array of device pointers in pvals and the length of each array in plens. Note that each pointer is only valid in the context in which you allocated it, so make sure you select the device before using the pointer with a kernel launch or API call.

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

Sidebar

Related Questions

I have an extra NTFS partition to store data that I want to use
I want to develop a program that copies a partition's 'data' only, to another
I have a some items that I want to partition in to a number
I have a mysql database table that I want to partition by date, particularly
I have fairly large amount of data which I would like to partition into
I have a list of names. I want to partition this list into groups
just want to verify that database partition is implemented only at the database level,
I have a large (~ 40gb ) SQL Server 2008 database that I would
Partition is a small class I created. I have thousands of partitions that reside
i want to copy nk.bin to partition on wince 6.0. i want that when

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.