compute icon indicating copy to clipboard operation
compute copied to clipboard

WIP: Distributed infrastructure and algorithms

Open jszuppe opened this issue 9 years ago • 9 comments

This is a "beta" version of distributed work infrastructure: distributed::context, distributed::command_queue, distributed::vector. I'm open to comments and suggestions.

The idea is pretty simple: distributed::context is a wrapper for many OpenCL contexts, distributed::command_queue - for many OpenCL command queues, and distributed::vector is a container that allocates memory across many devices according to certain weight function.

jszuppe avatar Aug 16 '16 20:08 jszuppe

I think about removing blocking argument from distributed::vector ctors and methods and instead use boost::optional for an optional reference to a wait_list object, but that would add additional dependency. Maybe I'll just remove it for first release and later think about this.

I also think I'll remove the queue from distributed::vector. Then I'll also have to change some of its constructors so they don't accept distributed::context but distributed::command_queue (empty ctor and ctor creating vector with count copies of some value).

It's turned out that having queue in distributed::vector may be very problematic... Most methods of boost::compute::command_queue are not const, so distributed::vector would need to have a non-const method that returns reference its distributed queue

jszuppe avatar Aug 17 '16 17:08 jszuppe

I added distributed::copy() algorithm with tests. For now distributed::copy() has many different lists of arguments depending on what your copying and in which way. After I introduce distributed_iterator(), it will be slightly simpler.

jszuppe avatar Aug 22 '16 19:08 jszuppe

Also, there are commits which are present in https://github.com/boostorg/compute/pull/648, but I'll remove them before this pull request is ready to be merged. @kylelutz any comments on the code?

jszuppe avatar Aug 22 '16 19:08 jszuppe

In copy_async() I can't use wait_list since it does not support event from different contexts. For example wait() method does not work properly when wait_list contains events from different contexts, which can happen using distributed::vector.

In 2nd half of September I will introduce changes to wait_list so it force user to store only events from the same OpenCL context, and maybe make new class for wrapping many events from different contexts (based on future or wait_list).

jszuppe avatar Aug 22 '16 23:08 jszuppe

Coverage Status

Changes Unknown when pulling 0601a353bf696d0d07d475f687052fd42a8c3538 on haahh:pr_distributed into * on boostorg:develop*.

coveralls avatar Aug 27 '16 22:08 coveralls

Coverage Status

Changes Unknown when pulling 0601a353bf696d0d07d475f687052fd42a8c3538 on haahh:pr_distributed into * on boostorg:develop*.

coveralls avatar Aug 27 '16 23:08 coveralls

distributed::transform() should have good performance, it's indirectly influenced by the weight function (currently all weights are equal, I will later add weight function based on device performance) since it waits for the slowest device.

distributed::reduce() should have good performance when all used devices (queues) are in the same context, but I have an idea how to make it works with the same speed in other cases.

jszuppe avatar Aug 28 '16 09:08 jszuppe

Coverage Status

Changes Unknown when pulling 56fb88137345b4ef499a5467c7505dead6af14e3 on haahh:pr_distributed into * on boostorg:develop*.

coveralls avatar Aug 28 '16 10:08 coveralls

Coverage Status

Changes Unknown when pulling 43c31b340180d2eccbee4e7839d60fb0e88a13bf on haahh:pr_distributed into * on boostorg:develop*.

coveralls avatar Aug 29 '16 21:08 coveralls