MESSAGE
DATE | 2016-10-31 |
FROM | Ruben Safir
|
SUBJECT | Re: [Learn] cuda kernels
|
From learn-bounces-at-nylxs.com Mon Oct 31 18:06:39 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 382BB161312; Mon, 31 Oct 2016 18:06:39 -0400 (EDT) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mail-qk0-f179.google.com (mail-qk0-f179.google.com [209.85.220.179]) by mrbrklyn.com (Postfix) with ESMTP id B30C1160E77 for ; Mon, 31 Oct 2016 18:06:35 -0400 (EDT) Received: by mail-qk0-f179.google.com with SMTP id o68so180059457qkf.3 for ; Mon, 31 Oct 2016 15:06:34 -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=DNWNOSTEJqsjWIEpntU0M2aAVJNU/7IB/BDjpfXBYaQ=; b=cxTPOXOzhKrnOz385S/LY1ybOpeGLQ5QAei4phlNSH42wWo1xRC00Bks3HYz0HlRAt nCpO+VY3GNa4GowYpkRzeqv4Z2oZu4UVdAfp3G1mM6RS/zORcQDJJNDenFJMH4ysevBi lzjfj0C4/lQK32vQ/lYmcB9ozRDvLbg2yw6tc= 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=DNWNOSTEJqsjWIEpntU0M2aAVJNU/7IB/BDjpfXBYaQ=; b=Bgcd3UevaR8C+4+Kcyxu+h1DP/dDXVXIV+QXJgC7vOkCYTnqx7I+tVj8AjnnNmXqJ2 ZjyPKiGVYjyI0lWXzR/7kXiGZZoFR3E2zPhkXiFT3V6Xru23/Ym8kXZwcMZQYzBnwz4R QoYuy5xzODd6l9xcHQELtnUceojn9khIH49ZF0rkVt0wpzm6wgZZ/k9/BlWH23gFozYY BFQJ478nJVzoj4t05KeN11HuOlYBisgmmLdKD1pvdvWJSM2Mp/nd/D2/PxcfkyWmQcBt jczb5MjMD1H6TWZ+jU+mZr1+dYHQyyxF5Q/QSYTwfrv3HeoDoPPY2QWx1swMTpCwZ7n4 iScg== X-Gm-Message-State: ABUngve21UUoANnj+nCgwcSYD2TzpZ0Qouh+rLt+6NKom2pwwou1cU+2MupU1ug6IbjYIzKy X-Received: by 10.55.27.226 with SMTP id m95mr29445042qkh.143.1477951254214; Mon, 31 Oct 2016 15:00:54 -0700 (PDT) Received: from [10.0.0.62] (www.mrbrklyn.com. [96.57.23.82]) by smtp.googlemail.com with ESMTPSA id j2sm14201094qtb.46.2016.10.31.15.00.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 15:00:53 -0700 (PDT) To: learn-at-nylxs.com References: <9570d66b-7c02-4e2d-3225-20e008158f0d-at-mrbrklyn.com> <87lgx48apw.fsf-at-contrapunctus.net> From: Ruben Safir Message-ID: <9195064a-00e1-19a4-cc27-d57f4cf82220-at-my.liu.edu> Date: Mon, 31 Oct 2016 18:00:53 -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: <87lgx48apw.fsf-at-contrapunctus.net> Subject: Re: [Learn] cuda kernels 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="windows-1252" Content-Transfer-Encoding: quoted-printable Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
On 10/31/2016 05:33 PM, Christopher League wrote: > Ruben Safir ruben-at-mrbrklyn.com writes: > =
> The video says that the below lines ask for 64 copys of the kernel > on 64 threads? I don=92t see that > =
> |cudaMemcpy(d_in, h_in, ARRAY_BYTES, cudaMemcpyHostToDevice); > //launch kernel square<<<1, ARRAY_SIZE>>>(d_in, d_out); > cudaMemcpy(h_out, d_out, ARRAY_BYTES, cudaMemcpyDeviceToHost);| > =
> I don=92t really know anything about CUDA yet, but ARRAY_SIZE was 64. And > this syntax: |square<<<1, ARRAY_SIZE>>>| is NOT valid C/C++ syntax. So I > assume that the specialized GPU compiler interprets that in a way that > it distributes the computation of the |square| function across 64 GPU > threads=85? > =
> BTW, I=92m pretty sure =93kernel=94 here doesn=92t refer to =93the Linux = kernel.=94
No this is someones idea of how to teach parallel programming which is to use a NVIDEO GPU and CUDA. WHy they couldn't come up with some idea of what to call it other than "kernel" (maybe thread_instance or maybe a closure ;) )
Actually, it is like a closure in that it is run through a thread with a loop on each block? See the linked code for an example.
http://www.nylxs.com/docs/grad_school/parallel/src/cuda_second.c
ruben is me let.me.in lets me in to most places
Maybe I am not understanding this yet. I promoised Samir I would catch up with this class by Monday and it is Monday night. I need to do this online class from udacity and UC Davis
I hate these video classes. I took one on Coursera for paelontology and these things are watered down to the DUMBASS level. They talk to you like your an idiot and they lull me to sleep. I'd give my right arm for a textbook
https://www.udacity.com/course/intro-to-parallel-programming--cs344
These things are WORSE than the US Army video on venereal disease or how to strip an M16.
It is killing me to do this and I'm not learning much for the time spent. One thing that really is puzzling me is how memory is being allocated and freed. See this line of code
cudaFree(d_out); cudaMalloc(( void **) &d_out, ARRAY_BYTES ); cube<<<1, ARRAY_SIZE>>>(d_in, d_out); cudaMemcpy(h_out, d_out, ARRAY_BYTES, cudaMemcpyDeviceToHost); //h_out i s a static array. Can you memcpy like this?
for( int i =3D 0; i < ARRAY_SIZE; i++) { printf("Output =3D> %f ", h_out[i]); } //Free GPU cudaFree(d_in); cudaFree(d_out);
I'm trying to reuse an array for two different kernel calls and it dawns on me, yah know, the are allocating dynamic memory to a built in array... like WTF, can you do that?
Ruben
> =
> CL > =
> =
> =
> _______________________________________________ > Learn mailing list > Learn-at-nylxs.com > http://lists.mrbrklyn.com/mailman/listinfo/learn > =
-- =
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
|
|