Data parallel programming with OpenMP and Cilk Plus

2013-09-19 Thread Paul Jurczak
I would like to know if there are any obvious show-stoppers with using OpenMP and Cilk Plus with D through C interface? In the simplest case I have an array float[N] and I want to pass it to C function, which will modify it using OpenMP and Cilk Plus.

Re: Stride in foreach ranges

2013-08-30 Thread Paul Jurczak
On Friday, 30 August 2013 at 14:18:22 UTC, Dicebot wrote: On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote: BTW, DMD produces faster code when for loop is used instead, with GDC it makes no difference. This pretty much shows that there is nothing wrong in language with current

Re: Stride in foreach ranges

2013-08-30 Thread Paul Jurczak
On Friday, 30 August 2013 at 17:19:11 UTC, Paul Jurczak wrote: On Friday, 30 August 2013 at 14:11:06 UTC, Namespace wrote: [..] Can you prove this on DPaste? It's there at: http://dpaste.dzfl.pl/2cf504db I'm not sure what are the compiler switches on DPaste and I don't s

Re: Stride in foreach ranges

2013-08-30 Thread Paul Jurczak
On Friday, 30 August 2013 at 14:11:06 UTC, Namespace wrote: On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote: Is there a better way to express a range with stride than this: foreach (i; iota(0, N, 2)) Maybe something similar to F# syntax: foreach (i; 0..2..N) I found this

Stride in foreach ranges

2013-08-29 Thread Paul Jurczak
Is there a better way to express a range with stride than this: foreach (i; iota(0, N, 2)) Maybe something similar to F# syntax: foreach (i; 0..2..N) I found this thread suggesting syntax improvement http://forum.dlang.org/thread/bug-411...@http.d.puremagic.com/issues/ but I don't think it p

Re: What is a concise way to test if floating point value is integral?

2013-08-29 Thread Paul Jurczak
On Thursday, 29 August 2013 at 08:26:11 UTC, Jonathan M Davis wrote: On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote: On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis wrote: [..] > as any integral value in a float will fit in an > int. [..] Will it? Most of the

Re: What is a concise way to test if floating point value is integral?

2013-08-29 Thread Paul Jurczak
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis wrote: [..] as any integral value in a float will fit in an int. [..] Will it? Most of them will not fit, but cast to int produces nonsensical value anyway as in this example: cast(int)float.max With to!int you get a proper warn

Re: What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
On Thursday, 29 August 2013 at 06:23:18 UTC, Jonathan M Davis wrote: On Thursday, August 29, 2013 07:47:16 Paul Jurczak wrote: I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningles

Re: What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
On Thursday, 29 August 2013 at 05:47:43 UTC, Paul Jurczak wrote: I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningless variable to hold expression being tested. Is there an equ

What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningless variable to hold expression being tested. Is there an equivalent of std.math.trunc(), which would return fractional portion instead, ma

Re: Strange behavior of read file

2013-08-27 Thread Paul Jurczak
On Tuesday, 27 August 2013 at 17:19:08 UTC, monarch_dodra wrote: On Tuesday, 27 August 2013 at 17:14:23 UTC, Paul Jurczak wrote: Correction to my initial post: I'll investigate later then. monarch_dodra, H. S. Teoh, Ramon, Justin Whear, Jesse Phillips: Sorry for the delay in respondin

Re: Strange behavior of read file

2013-08-27 Thread Paul Jurczak
Correction to my initial post: I oversimplified the code example by snipping too much of context. Here is an example, which fails both on Windows and Linux: module main; import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple; int e67_1(stri

Strange behavior of read file

2013-08-27 Thread Paul Jurczak
module main; import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple; int f(string fileName = r"C:\Euler\data\e67.txt") { auto text = read(fileName); return text.length; } void main() { try { string fileName = r"C:\Euler\data\e67.t