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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:24:47+00:00 2026-06-12T22:24:47+00:00

Using device_vector: thrust::device_vector< int > iVec; int* iArray = thrust::raw_pointer_cast( &iVec[0] ); but how

  • 0

Using device_vector:

thrust::device_vector< int > iVec;
int* iArray = thrust::raw_pointer_cast( &iVec[0] );

but how can I do it if I have an array of device_vectors?

thrust::device_vector<int> iVec[10];

Ideally I would like to pass my array of device_vector to a 1D array to be handled on a CUDA kernel. Is it possible?

  • 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-12T22:24:48+00:00Added an answer on June 12, 2026 at 10:24 pm

    If I have understood your question correctly, what you are really try to do is create an array of raw pointers from an array of thrust::device_vectors. You should be able to do this like so:

    const int N = 10;
    thrust::device_vector<int> iVec[N];
    
    int * iRaw[N];
    for(int i=0; i<N; i++)
        iRaw[i] = thrust::raw_pointer_cast(iVec[i].data());
    
    int ** _iRaw;
    size_t sz = sizeof(int *) * N;
    cudaMalloc((void ***)&_iRaw, sz);
    cudaMemcpy(_iRaw, iRaw, sz, cudaMemcpyHostToDevice);
    

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

    In the above code snippet, _iRaw holds the raw pointers of each of the device vectors in iVec. You could pass that to a kernel if you really wanted to.

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

Sidebar

Related Questions

If I initialize x using thrust::device_vector<double> x(10) , is it possible to create a
I'm trying to find the minimum number in a array using Thrust and CUDA.
Recently I have been using thrust a lot. I have noticed that in order
I am using the thrust partition function to partition array into even and odd
I'm using Thrust in my current project so I don't have to write a
I can drop a SqlServer Backup Device using SQL-DMO using the following pseudo-code: SQLDMO.SQLServer2
I'm trying to compile a block of example code using Thrust in an attempt
I'm trying to modify a simple dynamic vector in CUDA using the thrust library
I am trying to perform a thrust::reduce_by_key using zip and permutation iterators. i.e. doing
I have a very simple AS3 app that draws few circles using drawing api

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.