@@ -4,7 +4,7 @@ open Argu
44open Argu.ArguAttributes
55open Brahma.FSharp
66
7- type Platforms = CPU = 1 | NVidia = 2 | IntelGPU = 3 | AnyGPU = 4
7+ type Platforms = CPU = 1 | CPUParallel = 2 | NVidia = 3 | IntelGPU = 4 | AnyGPU = 5
88
99[<CliPrefix( CliPrefix.DoubleDash) >]
1010[<NoAppSettings>]
@@ -48,7 +48,7 @@ module Main =
4848 ImageProcessing.edgesKernel
4949 ]
5050
51-
51+ (*
5252 let applyFiltersOnGPU =
5353 let device =
5454 match platform with
@@ -64,7 +64,8 @@ module Main =
6464
6565 let context = ClContext(device)
6666 ImageProcessing.applyFiltersGPU context 64
67- (*
67+ *)
68+
6869 match platform with
6970 | Platforms.CPU ->
7071 let mutable image = ImageProcessing.loadAs2DArray input
@@ -74,7 +75,16 @@ module Main =
7475 image <- ImageProcessing.applyFilter filter image
7576 printfn $" CPU processing time: {(System.DateTime.Now - start).TotalMilliseconds} ms"
7677 ImageProcessing.save2DByteArrayAsImage image output
77- | _ ->
78+ | Platforms.CPUParallel ->
79+ let mutable image = ImageProcessing.loadAs2DArray input
80+ printfn $" Device: CPU, parallel"
81+ let start = System.DateTime.Now
82+ for filter in filters do
83+ image <- ImageProcessing.applyFilterCpuParallel filter image
84+ printfn $" CPU processing time: {(System.DateTime.Now - start).TotalMilliseconds} ms"
85+ ImageProcessing.save2DByteArrayAsImage image output
86+
87+ (* | _ ->
7888 let start = System.DateTime.Now
7989 let grayscaleImage = ImageProcessing.loadAsImage input
8090 printfn $"Image reading time: {(System.DateTime.Now - start).TotalMilliseconds} ms"
@@ -84,7 +94,8 @@ module Main =
8494 printfn $"GPU processing time: {(System.DateTime.Now - start).TotalMilliseconds} ms"
8595 printfn $"R: %A{result}"
8696 ImageProcessing.saveImage result output
87- *)
97+ *)
98+ (*
8899
89100 let start = System.DateTime.Now
90101
@@ -97,5 +108,5 @@ module Main =
97108 - start)
98109 .TotalMilliseconds}"
99110
100-
111+ *)
101112 0
0 commit comments