Re: LDC 1.4.0

2017-09-11 Thread Moritz Maxeiner via Digitalmars-d-announce

On Monday, 11 September 2017 at 23:32:55 UTC, kinke wrote:

Hi everyone,

on behalf of the LDC team, I'm glad to announce LDC 1.4.0. The 
highlights of version 1.4 in a nutshell:


* Based on D 2.074.1.
[...]


Fantastic news, thanks for your work!



LDC 1.4.0

2017-09-11 Thread kinke via Digitalmars-d-announce

Hi everyone,

on behalf of the LDC team, I'm glad to announce LDC 1.4.0. The 
highlights of version 1.4 in a nutshell:


* Based on D 2.074.1.
* Shipping with ldc-build-runtime, a small D tool to easily 
(cross-)compile the runtime libraries yourself.

* Full Android support, incl. emulated TLS.
* Improved support for AddressSanitizer and libFuzzer. The 
libraries are shipped with the prebuilt Linux x86_64 and OSX 
packages.
* Prebuilt Linux x86_64 package shipping with LTO plugin, 
catching up with the OSX package.
* Prebuilt packages include the NVPTX LLVM target, in order to 
target CUDA via DCompute.


Full release log and downloads: 
https://github.com/ldc-developers/ldc/releases/tag/v1.4.0


Thanks to everybody contributing!


Re: DCompute: First kernels run successfully

2017-09-11 Thread Nicholas Wilson via Digitalmars-d-announce

On Monday, 11 September 2017 at 22:40:02 UTC, Walter Bright wrote:

On 9/11/2017 5:23 AM, Nicholas Wilson wrote:
I'm pleased to announce that I have run the first dcompute 
kernel and it was a success!


Excellent!


https://media.licdn.com/mpr/mpr/AAEAAQgvJDY4OTI4MmE0LTVlZDgtNGQzYy1iN2U1LWU5Nzk1NjlhNzIwNg.jpg


Indeed the the world domination begin!

I just need to get some OpenCL 2.0 capable hardware to test that 
and we'll be well on the way.


AlsoLDC1.4 was just released Yay!


Re: DCompute: First kernels run successfully

2017-09-11 Thread Nicholas Wilson via Digitalmars-d-announce

On Monday, 11 September 2017 at 20:45:43 UTC, kerdemdemir wrote:

Hi Wilson,

Since I believe GPU-CPU hybrid programming is the future I 
believe you are doing a great job for your and D lang's future.


To successfully run the dcompute CUDA test you will need a 
very recent LDC (less than two days) with the NVPTX backend* 
enabled along with a CUDA environment and an Nvidia GPU.


*Or wait for LDC 1.4 release real soon(™).


Can you please describe a bit about for starters like me how to 
build recent LDC.


Is this "NVPTX backend" a cmake option?
And what should I do for making my "CUDA environment" ready? 
Which packages should I install?


Sorry if my questions are so dummy I hope I will be able to add 
an example.


Regards
Erdem



Hi Erdem

Sorry I've been a bit busy with uni. To build LDC just clone ldc 
and `git submodule --init` and run cmake, setting LLVM_CONFIG to 
/path/to/llvm/build/bin/llvm-config and LLVM_INTRINSIC_TD_PATH to 
/path/to/llvm/source/include/llvm/IR


The nvptx backend is enabled by setting LLVM's cmake variable 
LLVM_TARGETS_TO_BUILD to either "all", or "X86;NVPTX" along with 
any other archs you want to enable, (without the quotes) and then 
building LLVM with cmake. This will get picked up by LDC 
automatically.


I just installed the CUDA sdk in its entirety, but I'm sure you 
don't need everything from it.




Re: DCompute: First kernels run successfully

2017-09-11 Thread Walter Bright via Digitalmars-d-announce

On 9/11/2017 5:23 AM, Nicholas Wilson wrote:
I'm pleased to announce that I have run the first dcompute kernel and it was a 
success!


Excellent!


https://media.licdn.com/mpr/mpr/AAEAAQgvJDY4OTI4MmE0LTVlZDgtNGQzYy1iN2U1LWU5Nzk1NjlhNzIwNg.jpg


Re: D on devdocs

2017-09-11 Thread Andre Pany via Digitalmars-d-announce

On Monday, 11 September 2017 at 03:23:47 UTC, ANtlord wrote:
Hello. I'm not sure that you know, but documentation of D 
language has become to devdocs.io. It is web service provides 
offline documentation. We've got a useful tool for 
documentation viewing and reading. The next step is an 
implementation of version support.


Don't compare anything to D. Use D.

http://devdocs.io/d/


Great work!
I noticed a small issue in the second example of 
http://devdocs.io/d/std_base64. Almost the whole code had the 
green (string) color. Maybe is there an issue with two strings 
seperated by a comma.


Kind regards
André


Re: DCompute: First kernels run successfully

2017-09-11 Thread kerdemdemir via Digitalmars-d-announce

Hi Wilson,

Since I believe GPU-CPU hybrid programming is the future I 
believe you are doing a great job for your and D lang's future.


To successfully run the dcompute CUDA test you will need a very 
recent LDC (less than two days) with the NVPTX backend* enabled 
along with a CUDA environment and an Nvidia GPU.


*Or wait for LDC 1.4 release real soon(™).


Can you please describe a bit about for starters like me how to 
build recent LDC.


Is this "NVPTX backend" a cmake option?
And what should I do for making my "CUDA environment" ready? 
Which packages should I install?


Sorry if my questions are so dummy I hope I will be able to add 
an example.


Regards
Erdem


Re: D on devdocs

2017-09-11 Thread Ali Çehreli via Digitalmars-d-announce

On 09/11/2017 09:17 AM, ANtlord wrote:

> we should develop only one Scrapper

Ali's worthless contribution of the day: It should be Scraper.

Ali



Re: D on devdocs

2017-09-11 Thread ANtlord via Digitalmars-d-announce
On Monday, 11 September 2017 at 15:02:17 UTC, Moritz Maxeiner 
wrote:
Do you know how much work would it be to reuse devdocs (I see 
it is open source) as a basis for hosting dub package docs)?


I'm sorry, but I can't assess required time because I'm not a 
Ruby developer. I have learned basics of the language to add D to 
the service. If we have the same format for every package 
documentation on code.dlang.org we should develop only one 
Scrapper. But I suggest asking for a Ruby developer to assess 
required time for the implementation.


Re: DCompute: First kernels run successfully

2017-09-11 Thread jmh530 via Digitalmars-d-announce
On Monday, 11 September 2017 at 12:23:16 UTC, Nicholas Wilson 
wrote:
I'm pleased to announce that I have run the first dcompute 
kernel and it was a success!




Keep up the good work.


Re: LDC 1.4.0-beta1

2017-09-11 Thread jmh530 via Digitalmars-d-announce

On Monday, 11 September 2017 at 14:49:44 UTC, kinke wrote:


There's a difference between "doesn't compile" and "asserts".
Please always compare to the matching DMD version, 2.074.1 in 
this case, which produces an empty string as well, I guess 
because the writer was taken by value in Phobos 2.074.1.


Fair point on the DMD versioning. I think I was only using the 
most recent DMD. I had thought this capability was added in 
2.074.0 when the CT string feature was added, but the changelogs 
only reference formattedRead, not formattedWrite.


https://dlang.org/changelog/2.074.0.html#std-format-formattedRead

I don't know when it was actually added.


Re: D on devdocs

2017-09-11 Thread Moritz Maxeiner via Digitalmars-d-announce

On Monday, 11 September 2017 at 03:23:47 UTC, ANtlord wrote:
Hello. I'm not sure that you know, but documentation of D 
language has become to devdocs.io. It is web service provides 
offline documentation. We've got a useful tool for 
documentation viewing and reading. The next step is an 
implementation of version support.


Didn't know about it until it was mentioned in another thread 
here recently [1], but I do think this is great and I especially 
like their dark theme (clean, minimal).
Do you know how much work would it be to reuse devdocs (I see it 
is open source) as a basis for hosting dub package docs)?


[1] 
http://forum.dlang.org/thread/mailman.6556.1504522081.31550.digitalmar...@puremagic.com


Re: LDC 1.4.0-beta1

2017-09-11 Thread kinke via Digitalmars-d-announce

On Sunday, 10 September 2017 at 16:25:52 UTC, jmh530 wrote:
The following code compiles on DMD, but not on LDC (tested 
versions 1.3.0 and the 1.4.0 beta).


unittest
{
import std.array : appender;
import std.format : formattedWrite;

auto x = appender!(string);
typeof(x) y;

formattedWrite(y, "%2s", [0, 1]);
assert(y.data == "[ 0,  1]");
}


There's a difference between "doesn't compile" and "asserts".
Please always compare to the matching DMD version, 2.074.1 in 
this case, which produces an empty string as well, I guess 
because the writer was taken by value in Phobos 2.074.1.


Re: D on devdocs

2017-09-11 Thread Adil Baig via Digitalmars-d-announce
Bravo.

I don't know how many people actually use the service, but lots of
web/backend devs use devdocs. This puts D on their map and, hopefully, we
get attention from a much larger audience.

On Mon, Sep 11, 2017 at 7:23 AM, ANtlord via Digitalmars-d-announce <
digitalmars-d-announce@puremagic.com> wrote:

> Hello. I'm not sure that you know, but documentation of D language has
> become to devdocs.io. It is web service provides offline documentation.
> We've got a useful tool for documentation viewing and reading. The next
> step is an implementation of version support.
>
> Don't compare anything to D. Use D.
>
> http://devdocs.io/d/
>


DCompute: First kernels run successfully

2017-09-11 Thread Nicholas Wilson via Digitalmars-d-announce
I'm pleased to announce that I have run the first dcompute kernel 
and it was a success!


There is still a fair bit of polish to the driver needed to make 
the API sane and more complete, not to mention more similar to 
the (untested) OpenCL driver API. But it works!

(Contributions are of course greatly welcomed)

The kernel:
```
@compute(CompileFor.deviceOnly)
module dcompute.tests.dummykernels;

import ldc.dcompute;
import dcompute.std.index;

@kernel void saxpy(GlobalPointer!(float) res,
   float alpha,GlobalPointer!(float) x,
   GlobalPointer!(float) y,
   size_t N)
{
auto i = GlobalIndex.x;
if (i >= N) return;
res[i] = alpha*x[i] + y[i];
}
```

The host code:
```
import dcompute.driver.cuda;
import dcompute.tests.dummykernels : saxpy;

Platform.initialise();

auto devs   = Platform.getDevices(theAllocator);
auto ctx= Context(devs[0]); scope(exit) ctx.detach();

// Change the file to match your GPU.
Program.globalProgram = 
Program.fromFile("./.dub/obj/kernels_cuda210_64.ptx");

auto q = Queue(false);

enum size_t N = 128;
float alpha = 5.0;
float[N] res, x,y;
foreach (i; 0 .. N)
{
x[i] = N - i;
y[i] = i * i;
}
Buffer!(float) b_res, b_x, b_y;
b_res  =  Buffer!(float)(res[]); scope(exit) b_res.release();
b_x=  Buffer!(float)(x[]);   scope(exit) b_x.release();
b_y=  Buffer!(float)(y[]);   scope(exit) b_y.release();

b_x.copy!(Copy.hostToDevice); // not quite sold on this interface 
yet.

b_y.copy!(Copy.hostToDevice);

q.enqueue!(saxpy)  // <-- the main magic happens here
([N,1,1],[1,1,1])   // the grid
(b_res,alpha,b_x,b_y, N); // the kernel arguments

b_res.copy!(Copy.deviceToHost);
foreach(i; 0 .. N)
enforce(res[i] == alpha * x[i] + y[i]);
writeln(res[]); // [640, 636, ... 16134]
```

Simple as that!

Dcompute, as always, is at https://github.com/libmir/dcompute and 
on dub.


To successfully run the dcompute CUDA test you will need a very 
recent LDC (less than two days) with the NVPTX backend* enabled 
along with a CUDA environment and an Nvidia GPU.


*Or wait for LDC 1.4 release real soon(™).

Thanks to the LDC folks for putting up with me ;)

Have fun GPU programming,
Nic