MESSAGE
DATE | 2016-11-01 |
FROM | Ruben Safir
|
SUBJECT | Re: [Learn] not adequately speced of explained
|
From learn-bounces-at-nylxs.com Tue Nov 1 14:19:46 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 42EF2161312; Tue, 1 Nov 2016 14:19:46 -0400 (EDT) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) by mrbrklyn.com (Postfix) with ESMTP id E66D0160E77 for ; Tue, 1 Nov 2016 14:19:43 -0400 (EDT) Received: by mail-qt0-f194.google.com with SMTP id n6so2958769qtd.0 for ; Tue, 01 Nov 2016 11:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=my.liu.edu; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=0M1lzcEspvZkZFUdHGC4bCOzLy4kijyNUdbVfwBzWQI=; b=hE+oNqivf3MIHEU0aLDSrRDdC/2L50k/iiN6OAuEu3ds2jBMixGEiFXLArAsRkfMcC aODRuTo2Z0gNs/GEUEoyoYBQUQB8+OCmuHEQP/YNy3ufs61XpZzwl+I+FcrEbaKq0PpS wRw4nUxjlWv2EYom7ZrqU0WbBudFDPFmMbt3g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=0M1lzcEspvZkZFUdHGC4bCOzLy4kijyNUdbVfwBzWQI=; b=WPGDB7CpaCCDPayZfECSoeFg5VAoK/oHDeenlX7HgTry8TCvdTI+iz7KPxD2Q5NP7J LydNUOtuJnCLExndGacVJITAbPIYiNKaGYntY9/DYjIvrEoILZiU2Sf3YLDOEzLwwzJO WHA08BW4A+mOZ5ZsA/nX9+ispgOqkzTZmUWuZ3VXxYByAYXVB2kba+yFZfTOIDHZAgFz IugP0ImjxjzZk5Qbdo9O2yOIerjBr2gtcl6MDzB+o80Ifk9N6fOzYhYmB3XZRwWWJaAL HqzqQ7SU/D46x+LMNCKnVjV6iGISr3NWzzMSAnttH9i6TPegE9YSYcIQdt9nW2O70fgh x+2w== X-Gm-Message-State: ABUngvcpL5mnWaHl0o9muad/VQDXgpAfJgTnwSQpKEpuDT3rQLU8dI5Q5qfF4sK5FbcfdA6h X-Received: by 10.237.51.167 with SMTP id v36mr27913209qtd.46.1478024383100; Tue, 01 Nov 2016 11:19:43 -0700 (PDT) Received: from [10.0.0.62] (www.mrbrklyn.com. [96.57.23.82]) by smtp.googlemail.com with ESMTPSA id o44sm16391536qtc.10.2016.11.01.11.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 11:19:42 -0700 (PDT) To: Ruben Safir , learn-at-nylxs.com, Samir Iabbassen References: <762d70d0-7fba-6459-fae1-6079565a6750-at-mrbrklyn.com> From: Ruben Safir Message-ID: Date: Tue, 1 Nov 2016 14:19:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <762d70d0-7fba-6459-fae1-6079565a6750-at-mrbrklyn.com> Subject: Re: [Learn] not adequately speced of explained X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
On 11/01/2016 12:30 PM, Ruben Safir wrote: > Why am I wasting my time with this video on CUDA > > Look at this stupid homework. There is not enough specification here to > attempt the home work. Instead your expected to beg the website for > more information. > > We do NOT know the construction of the graphics. I don't even know what > a uchar4 is but that is not the least of the problem. I don't know is a > uchar4 is a mapping of data. I have NO CLUE what the two extra params are. > > I didn't even know that i could add two additional params to the GLOBAL > kernel. > > I'm sick of WASTING TIME with sloppy crap like this. I can waste hours > of time trying to unravel the mystery of this. > > > > I don't know what 2D is. I don't know what I am mapping. I don't have > a specification of any data structures whatsoever. > > > I HAVE NO DAMN SPECIFICATION HERE. > > Why are we not using the MIT resources that are well thought out and > dumbed down to being unusable. > > > Why do I have to wander all the time in the dark. > > https://classroom.udacity.com/courses/cs344/lessons/55120467/concepts/967066740923 > > > // Homework 1 > // Color to Greyscale Conversion > > //A common way to represent color images is known as RGBA - the color > //is specified by how much Red, Green, and Blue is in it. > //The 'A' stands for Alpha and is used for transparency; it will be > //ignored in this homework. > > //Each channel Red, Blue, Green, and Alpha is represented by one byte. > //Since we are using one byte for each color there are 256 different > //possible values for each color. This means we use 4 bytes per pixel. > > //Greyscale images are represented by a single intensity value per pixel > //which is one byte in size. > > //To convert an image from color to grayscale one simple method is to > //set the intensity to the average of the RGB channels. But we will > //use a more sophisticated method that takes into account how the eye > //perceives color and weights the channels unequally. > > //The eye responds most strongly to green followed by red and then blue. > //The NTSC (National Television System Committee) recommends the following > //formula for color to greyscale conversion: > > //I = .299f * R + .587f * G + .114f * B > > //Notice the trailing f's on the numbers which indicate that they are > //single precision floating point constants and not double precision > //constants. > > //You should fill in the kernel as well as set the block and grid sizes > //so that the entire image is processed. > > #include "reference_calc.cpp" > #include "utils.h" > #include > > __global__ > void rgba_to_greyscale(const uchar4* const rgbaImage, > unsigned char* const greyImage, > int numRows, int numCols) > { > //TODO > //Fill in the kernel to convert from color to greyscale > //the mapping from components of a uchar4 to RGBA is: > // .x -> R ; .y -> G ; .z -> B ; .w -> A > // > //The output (greyImage) at each pixel should be the result of > //applying the formula: output = .299f * R + .587f * G + .114f * B; > //Note: We will be ignoring the alpha channel for this conversion > > //First create a mapping from the 2D block and grid locations > //to an absolute 2D location in the image, then use that to > //calculate a 1D offset > > int R = threadIdx.x; > int G = threadIdx.y; > int B = threadIdx.z; > > float fR = float(R) * 0.299f; > float fG = float(G) * 0.587f; > float fB = float(B) * 0.114f; > > float ave = (fR + fG + fB) / 3f ; > > > } > > void your_rgba_to_greyscale(const uchar4 * const h_rgbaImage, uchar4 * > const d_rgbaImage, > unsigned char* const d_greyImage, size_t > numRows, size_t numCols) > { > //You must fill in the correct sizes for the blockSize and gridSize > //currently only one block with one thread is being launched > const dim3 blockSize(1, 1, 1); //TODO > const dim3 gridSize( 1, 1, 1); //TODO > rgba_to_greyscale<<>>(d_rgbaImage, d_greyImage, > numRows, numCols); > > cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError()); > } >
This is from the documentation.
B.19. Execution Configuration
Any call to a __global__ function must specify the execution configuration for that call. The execution configuration defines the dimension of the grid and blocks that will be used to execute the function on the device, as well as the associated stream (see CUDA C Runtime for a description of streams).
The execution configuration is specified by inserting an expression of the form <<< Dg, Db, Ns, S >>> between the function name and the parenthesized argument list, where:
Dg is of type dim3 (see dim3) and specifies the dimension and size of the grid, such that Dg.x * Dg.y * Dg.z equals the number of blocks being launched; Db is of type dim3 (see dim3) and specifies the dimension and size of each block, such that Db.x * Db.y * Db.z equals the number of threads per block; Ns is of type size_t and specifies the number of bytes in shared memory that is dynamically allocated per block for this call in addition to the statically allocated memory; this dynamically allocated memory is used by any of the variables declared as an external array as mentioned in __shared__; Ns is an optional argument which defaults to 0; S is of type cudaStream_t and specifies the associated stream; S is an optional argument which defaults to 0.
As an example, a function declared as
__global__ void Func(float* parameter);
must be called like this:
Func<<< Dg, Db, Ns >>>(parameter);
The arguments to the execution configuration are evaluated before the actual function arguments.
The function call will fail if Dg or Db are greater than the maximum sizes allowed for the device as specified in Compute Capabilities, or if Ns is greater than the maximum amount of shared memory available on the device, minus the amount of shared memory required for static allocation.
-- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|