Re: How to recursively accept data from Python server ?

2021-06-24 Thread Utk via Digitalmars-d-learn
On Friday, 25 June 2021 at 03:27:24 UTC, jfondren wrote: On Friday, 25 June 2021 at 02:55:50 UTC, Utk wrote: Please help me to resolve this issue. Try stracing your program to see exactly what it's doing with the socket, and try std.socket's lastSocketError I tried using

Re: How to recursively accept data from Python server ?

2021-06-24 Thread jfondren via Digitalmars-d-learn
On Friday, 25 June 2021 at 02:55:50 UTC, Utk wrote: Please help me to resolve this issue. Try stracing your program to see exactly what it's doing with the socket, and try std.socket's lastSocketError

Re: How to recursively accept data from Python server ?

2021-06-24 Thread mw via Digitalmars-d-learn
Not sure if you want build interprocess communication utility all by yourself, I'm currently using https://code.dlang.org/packages/apache-thrift and there is also https://code.dlang.org/packages/symmetry_thrift_d BTW grpc is not quiet working https://code.dlang.org/packages/grpc

How to recursively accept data from Python server ?

2021-06-24 Thread Utk via Digitalmars-d-learn
Hello! I'm trying to establish a connection between a python server and a d client. The data is been transferred properly only once and then the d client doesn't wait for any further data and returns an error ```Socket.ERROR``` and exists and doesn't wait for further incoming data from the

Re: How to call stop from parallel foreach

2021-06-24 Thread Ali Çehreli via Digitalmars-d-learn
On 6/24/21 1:41 PM, seany wrote: > Is there any way to control the number of CPU cores used in > parallelization ? Yes. You have to create a task pool explicitly: import std.parallelism; void main() { enum threadCount = 2; auto myTaskPool = new TaskPool(threadCount); scope (exit) {

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:56:26 UTC, Ali Çehreli wrote: On 6/24/21 1:33 PM, Bastiaan Veelo wrote: > distributes the load across all cores (but one). Last time I checked, the current thread would run tasks as well. Ali Indeed, thanks. — Bastiaan.

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 21:05:28 UTC, Bastiaan Veelo wrote: On Thursday, 24 June 2021 at 20:41:40 UTC, seany wrote: Is there any way to control the number of CPU cores used in parallelization ? E.g : take 3 cores for the first parallel foreach - and then for the second one, take 3 cores

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:41:40 UTC, seany wrote: On Thursday, 24 June 2021 at 20:33:00 UTC, Bastiaan Veelo wrote: By the way, nesting parallel `foreach` does not make much sense, as one level already distributes the load across all cores (but one). Additional parallelisation will

Re: How to call stop from parallel foreach

2021-06-24 Thread Ali Çehreli via Digitalmars-d-learn
On 6/24/21 1:33 PM, Bastiaan Veelo wrote: > distributes the load across all cores (but one). Last time I checked, the current thread would run tasks as well. Ali

Re: How to call stop from parallel foreach

2021-06-24 Thread seany via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:33:00 UTC, Bastiaan Veelo wrote: By the way, nesting parallel `foreach` does not make much sense, as one level already distributes the load across all cores (but one). Additional parallelisation will likely just add overhead, and have a net negative effect. —

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote: I have seen [this](https://forum.dlang.org/thread/akhbvvjgeaspmjntz...@forum.dlang.org). I can't call break form parallel foreach. Okey, Is there a way to easily call .stop() from such a case? Yes there is, but it won’t break the

Re: How to call stop from parallel foreach

2021-06-24 Thread seany via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:08:06 UTC, seany wrote: On Thursday, 24 June 2021 at 19:46:52 UTC, Jerry wrote: On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote: [...] Maybe I'm wrong here, but I don't think there is any way to do that with parallel. What I would do is negate

Re: How to call stop from parallel foreach

2021-06-24 Thread seany via Digitalmars-d-learn
On Thursday, 24 June 2021 at 19:46:52 UTC, Jerry wrote: On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote: [...] Maybe I'm wrong here, but I don't think there is any way to do that with parallel. What I would do is negate someConditionCheck and instead only do work when there is work

Re: How to call stop from parallel foreach

2021-06-24 Thread Jerry via Digitalmars-d-learn
On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote: I have seen [this](https://forum.dlang.org/thread/akhbvvjgeaspmjntz...@forum.dlang.org). I can't call break form parallel foreach. Okey, Is there a way to easily call .stop() from such a case? Here is a case to consider: outer:

How to call stop from parallel foreach

2021-06-24 Thread seany via Digitalmars-d-learn
I have seen [this](https://forum.dlang.org/thread/akhbvvjgeaspmjntz...@forum.dlang.org). I can't call break form parallel foreach. Okey, Is there a way to easily call .stop() from such a case? Here is a case to consider: outer: foreach(i, a; parallel(array_of_a)) { foreach(j, b;

Re: Are D classes proper reference types?

2021-06-24 Thread kinke via Digitalmars-d-learn
On Thursday, 24 June 2021 at 12:31:08 UTC, Stefan Koch wrote: On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler

Re: is it possible to sort a float range ?

2021-06-24 Thread someone via Digitalmars-d-learn
On Thursday, 24 June 2021 at 05:39:22 UTC, jfondren wrote: - ok, it's useful that it's like this Albeit (the grumbling and) the weirdness of it, this is exactly the reason why I am not complaining on such behavior -time will show me.

Re: How to I get pointer to an Array and cast to a void * and back ?

2021-06-24 Thread Dennis via Digitalmars-d-learn
On Thursday, 24 June 2021 at 14:06:11 UTC, seany wrote: void f() { a[] * rd; // DO SOME WORK HERE this.dataSet = & rd_flattened; rd = cast (a [] *) dataSet; write("length of rd is : "); writeln((*rd).length); // <--- this works.. // do some work

How to I get pointer to an Array and cast to a void * and back ?

2021-06-24 Thread seany via Digitalmars-d-learn
I have a struct : struct a { int i; // some more stuff ... } In a Class, I define public global `void * dataSet; ` In a function `f`, of the same class: i call : void f() { a[] rd_flattened; a[] * rd; // DO SOME WORK HERE this.dataSet =

Re: Are D classes proper reference types?

2021-06-24 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocate a class *instance* on the stack for you, but `c` is still a

Re: Are D classes proper reference types?

2021-06-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: *scope* classes are deprecated (I don't think I've ever seen one); I used it for my database thing where it is supposed to be destroyed reliably but also uses runtime polymorphism. I now suggest people just stick `scope(exit)

Re: Are D classes proper reference types?

2021-06-24 Thread kinke via Digitalmars-d-learn
On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] Yes, class *refs* are always pointers. *scope* classes are deprecated (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocate a class *instance* on the stack for you, but

Are D classes proper reference types?

2021-06-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
D classes are distinct from structs because they are intended to be bound to a reference (pointer) and not addressed as a value (inline/copying). But for efficiency reasons, scoped classes can stack-allocate, but my understanding is that the compiler can still allocate it on the GC heap? So