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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:56:54+00:00 2026-06-13T02:56:54+00:00

I am currently writing an application using C and CUDA. I have the algorithm

  • 0

I am currently writing an application using C and CUDA.
I have the algorithm working in pure C and converted it to CUDA.

The results are fine, and I am now in the process where of optimizing my code.

I profile the time that the kernel takes to get the results back, using a simple

clock_t start, end;
double cpu_time_used;
start = clock();

. . . my memcopies and my kernel . . . 

end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;

What surprises me is that the processing time is dramatically reduced when I run the whole program several times in a row.
When run it only once I average around 0.9 seconds. Running it ten times in a row I can go down to 0.1 seconds.

My real concern is that the Visual Profiler calculates its statistics based on 15 runs, which makes my first run to be overwhelmed by the really fast 14 other runs.

My program will later be ran once in a while, so what I want to optimize is the time of the first run.

My question is thus, is there a way to solve this, or know where it comes from ?

Thx !

EDIT:

I am running Windows 7, CUDA 4.2 Toolkit (2.1 capability) on a netbook

  • 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-13T02:56:55+00:00Added an answer on June 13, 2026 at 2:56 am

    If your objective is to provide for a quick startup, make sure your executable contains object code for the GPU architecture it will be run on.

    You can compile a “fat binary” with object code for several architecture, where a suitable version of the code selected at runtime. You can even (and should!) include PTX code as well in case none of the object code versions is suitable (e.g. to support future devices).

    Just supply multiple -gencode options to nvcc, one for each physical architecture (“sm_20”) you want to include object code for, as well as at least one with a virtual architecture (“compute_20”), that generates PTX code.

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

Sidebar

Related Questions

I am writing an application in java (1.6) using swing. I currently have a
I currently have an application I'm writing in c# (using .NET) that requires me
I am currently writing an application(using boost) that will have one producer grabbing frames
I'm currently writing an application using Vala that requires me to send data over
I'm currently writing a billing application using EF 5 Code First, and I'm running
I am currently writing a wizard-style application using Qt4. I am not using the
I'm writing Playframework 2.0 application using Scala and Anorm to access db. Currently I'm
I'm writing an application, and I'm currently using libcurl. The libcurl callback function works
I'm writing a web application that connects to a database. I'm currently using a
I'm currently writing an image editing application using Flex and I'm trying to make

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.