From 19d71f77a09c6b8fadf98f8795253c40bb5feb4a Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2017 08:54:15 -0400 Subject: [PATCH 1/2] Add CPUProcesses --- src/ComputationalResources.jl | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ComputationalResources.jl b/src/ComputationalResources.jl index 70e754f..6d2d2da 100644 --- a/src/ComputationalResources.jl +++ b/src/ComputationalResources.jl @@ -56,13 +56,12 @@ end CPU1() = CPU1(nothing) CPU1(r::AbstractResource) = CPU1(r.settings) + """ CPUThreads() CPUThreads(settings) - Indicate that a computation should be performed using the CPU in multi-threaded mode. Optionally pass in an object specifying algorithmic settings. - # Examples: ```julia filter(CPUThreads(), image, kernel) @@ -75,6 +74,27 @@ end CPUThreads() = CPUThreads(nothing) CPUThreads(r::AbstractResource) = CPUThreads(r.settings) +""" + CPUProcesses() + CPUProcesses(settings) + +Indicate that a computation should be performed using the CPU in multi-process mode. +Processes should be added with addprocs() or julia started with `julia -p N`. +Processes must communicate using distributed memory operations such as remote refrences. +Optionally pass in an object specifying algorithmic settings. + +# Examples: +```julia +filter(CPUProcesses(), image, kernel) +filter(CPUProcesses(TileSize(64,8)), image, kernel) +``` +""" +immutable CPUProcesses{T} <: AbstractCPU{T} + settings::T +end +CPUProcesses() = CPUProcesses(nothing) +CPUProcesses(r::AbstractResource) = CPUProcesses(r.settings) + """ ArrayFireLibs() ArrayFireLibs(settings) From 4dadf4d2b26535dbe33146ecbc13768da8d71daf Mon Sep 17 00:00:00 2001 From: James Fairbanks Date: Thu, 7 Sep 2017 15:22:40 -0400 Subject: [PATCH 2/2] fix whitespace --- src/ComputationalResources.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ComputationalResources.jl b/src/ComputationalResources.jl index 6d2d2da..bbb31c4 100644 --- a/src/ComputationalResources.jl +++ b/src/ComputationalResources.jl @@ -56,12 +56,13 @@ end CPU1() = CPU1(nothing) CPU1(r::AbstractResource) = CPU1(r.settings) - """ CPUThreads() CPUThreads(settings) + Indicate that a computation should be performed using the CPU in multi-threaded mode. Optionally pass in an object specifying algorithmic settings. + # Examples: ```julia filter(CPUThreads(), image, kernel)