Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Strange Syntax

Strange Syntax

Scheduled Pinned Locked Moved C / C++ / MFC
cssdata-structuresquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I saw this code snippet on a web page that was talking about CUDA[^] cores: Does anyone know the meaning of the syntax on the third line where they call the kernel function with those greater-than and less-than signs?

    dim3 blockDim(16, 16, 1);
    dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1);
    kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width);

    // Unbind the array from the texture
    cudaUnbindTexture(tex);
    } //end foo()

    __global__ void kernel(float* odata, int height, int width)
    {
    unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
    unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
    if (x < width && y < height) {
    float c = tex2D(tex, x, y);
    odata[y*width+x] = c;
    }
    }

    The difficult we do right away... ...the impossible takes slightly longer.

    CPalliniC 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I saw this code snippet on a web page that was talking about CUDA[^] cores: Does anyone know the meaning of the syntax on the third line where they call the kernel function with those greater-than and less-than signs?

      dim3 blockDim(16, 16, 1);
      dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1);
      kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width);

      // Unbind the array from the texture
      cudaUnbindTexture(tex);
      } //end foo()

      __global__ void kernel(float* odata, int height, int width)
      {
      unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
      unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
      if (x < width && y < height) {
      float c = tex2D(tex, x, y);
      odata[y*width+x] = c;
      }
      }

      The difficult we do right away... ...the impossible takes slightly longer.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      It is an extension of the NVIDIA CUDA compiler (see "Introduction to CUDA C"[^]:

      Triple angle brackets mark a call from host code to device code — Sometimes called a “kernel launch”

      THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

      In testa che avete, signor di Ceprano?

      Richard Andrew x64R 1 Reply Last reply
      0
      • CPalliniC CPallini

        It is an extension of the NVIDIA CUDA compiler (see "Introduction to CUDA C"[^]:

        Triple angle brackets mark a call from host code to device code — Sometimes called a “kernel launch”

        THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

        Richard Andrew x64R Offline
        Richard Andrew x64R Offline
        Richard Andrew x64
        wrote on last edited by
        #3

        Thank you.

        The difficult we do right away... ...the impossible takes slightly longer.

        CPalliniC 1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          Thank you.

          The difficult we do right away... ...the impossible takes slightly longer.

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          You are welcome.

          THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups