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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:34:54+00:00 2026-06-11T11:34:54+00:00

I have questions about making pinned memory. Now I’m using CUDA to deal with

  • 0

I have questions about making pinned memory.

Now I’m using CUDA to deal with great size of data.

To reduce run-time, I figure out it is necessary to make memory-copy and kernel-launch overlapped.

After searching some texts and web pages, to overlapping memory-copy and kernel-launch, I notice it is necessary to allocate host memory by using cudaMallocHost which will allocates host-memory to pinned memory.
In the case of using integer or array type on host, it was easy to make pinned memory.

Just like this…

cudaStream_t* streams = (cudaStream_t*)malloc(MAX_num_stream * sizeof(cudaStream_t));
for(i=0; i<MAX_num_stream; i++)
    cudaStreamCreate(&(streams[i]));

cudaMallocHost(&departure, its_size);

for(n=1; ... ; n++){
   cudaMemcpyAsync( ... streams[n]);
   kernel <<< ... , ... , ... , streams[n] >>> (...);
}

But in my case, my host departure memory is set by vertor type.

And I can’t find anywhere the way to turn vector-type-host-memory into pinned memory by using cudaMallocHost.

Help me or give some advice to solve this problem.
Thanks you for reading my poor English. Thanks.

  • 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-11T11:34:55+00:00Added an answer on June 11, 2026 at 11:34 am

    Directly, you can’t allocate memory for anything other POD types using cudaMallocHost.

    If you really need a std::vector which uses pinned memory, you will have to implement your own model of std::allocator which calls cudaMallocHost internally and instantiate your std::vector using that custom allocator.

    Alternatively, the thrust template library (which ships in recent releases of CUDA toolkit) includes an experimental pinned memory allocator which you could use with thrusts own vector class, which is iteself a model of std::vector.

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

Sidebar

Related Questions

I have some questions about using MySQLi queries, and related memory management. Suppose I
I have some questions about importing data from Excel/CSV File into SQL Server. Let
There are plenty of great answers to questions about making a standalone executable, but
I've read several questions about using a variable in multiple functions by making it
I am using Azure table storage and have questions about how nulls and default
I have some questions about logging, more specifically about setting it up and making
I have asked several questions about making links on images in matlab, but I
I have a few questions about PHP memory usage. I'm going to run some
I have a question about making static libraries that use other static libraries. I
I have a question about making a drawing app for Android. What is the

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.