Pinned or page-locked memory is transferred faster to GPUs compared to not-locked memory. CUDA provides the cudaHostAlloc and cudaHostRegister calls to allocate or register page-locked memory. The Nvidia driver then checks upon a memory transfer if the host memory is locked and issues according copy code paths.

Is it possible to page-lock memory with the system call mlock() achieving exactly the same effect (regards to transfer speeds) as cudaHostRegister ? Or does the according CUDA call update an internal database which the driver queries?

share|edit|flag
   upvote
  flag
The update may be added as an answer – pQB May 18 '12 at 13:43
up vote 1 down vote accepted

I think the NVIDIA driver maintains its own page-locked memory accessible via cudaHostAlloc etc. The system call mlock uses the kernel locking which is technically equivalent to what the driver does, but the kernel page-locking is very resource restricted RLIMIT_MEMLOCK which is very small. Thus NVIDIA driver uses its own page-locking mechanism. And they warn about excessive usage, since it steals lots of memory accessible to the rest of the kernel.

So, cudaHostRegister is equivalent to mlock() in the sense that it page-locks memory, but not in the sense that it is bound to resource limitations. And not in the sense, that cudaMemcpy is accelerated.

share|edit|flag

They are not equivalent. cuMemHostRegister() page-locks the memory, but also maps it into the page tables of the GPU (or, if portable, GPUs) so the GPU can access it directly. If you page-lock memory without mapping it for the GPU, it looks to the GPU just like any other memory.

share|edit|flag

Your Answer

  • Images are exactly like links, but they have an exclamation point in front of them:

    ![a busy cat](https://cdn.sstatic.net/Sites/stackoverflow/img/error-lolcat-problemz.jpg)
    ![two muppets][1]
    
     [1]: http://i.imgur.com/I5DFV.jpg "tooltip"
    

    The word in square brackets is the alt text, which gets displayed if the browser can't show the image. Be sure to include meaningful alt text for screen-reading software.

    Be sure to use text styling sparingly; only where it helps readability.

    *This is italicized*, and so
    is _this_.
    
    **This is bold**, just like __this__.
    
    You can ***combine*** them
    if you ___really have to___.
    

    To break your text into sections, you can use headers:

    A Large Header
    ==============
    
    Smaller Subheader
    -----------------
    

    Use hash marks if you need several levels of headers:

    # Header 1 #
    ## Header 2 ##
    ### Header 3 ###
    

    Both bulleted and numbered lists are possible:

    - Use a minus sign for a bullet
    + Or plus sign
    * Or an asterisk
    
    1. Numbered lists are easy
    2. Markdown keeps track of
     the numbers for you
    7. So this will be item 3.
    
    1. Lists in a list item:
        - Indented four spaces.
            * indented eight spaces.
        - Four spaces again.
    2.  You can have multiple
        paragraphs in a list items.
     
        Just be sure to indent.
    
    > Create a blockquote by
    > prepending “>” to each line.
    >
    > Other formatting also works here, e.g.
    >
    > 1. Lists or
    > 2. Headings:
    >
    > ## Quoted Heading ##
    

    You can even put blockquotes in blockquotes:

    > A standard blockquote is indented
    > > A nested blockquote is indented more
    > > > > You can nest to any depth.
    

    To create code blocks or other preformatted text, indent by four spaces:

        This will be displayed in a monospaced font. The first four spaces
        will be stripped off, but all other whitespace will be preserved.
        
        Markdown and HTML are turned off in code blocks:
        <i>This is not italic</i>, and [this is not a link](http://example.com)
    

    To create not a block, but an inline code span, use backticks:

    The `$` character is just a shortcut for `window.jQuery`.
    

    If you want to have a preformatted block within a list, indent by eight spaces:

    1. This is normal text.
    2. So is this, but now follows a code block:
     
            Skip a line and indent eight spaces.
            That's four spaces for the list
            and four to trigger the code block.
    

    If you need to do something that Markdown can't handle, use HTML. Note that we only support a very strict subset of HTML!

    Strikethrough humor is <strike>funny</strike>.
    

    Markdown is smart enough not to mangle your span-level HTML:

    <b>Markdown works *fine* in here.</b>
    

    Block-level HTML elements have a few restrictions:

    1. They must be separated from surrounding text by blank lines.
    2. The begin and end tags of the outermost block element must not be indented.
    3. Markdown can't be used within HTML blocks.

    <pre>
     You can <em>not</em> use Markdown in here.
    </pre>
    
 

Not the answer you're looking for? Browse other questions tagged or ask your own question.