anchor.diff:                  member __.Apply e = e.Eval m
           }
           |> MsgRun
  +
  +    static member CreateBarrierMessages numOfQueuesOnBarrier =
  +        let s = new SyncObject(numOfQueuesOnBarrier)
  +        Array.init numOfQueuesOnBarrier (fun i -> MsgBarrier s)
   type GPU(device: Device) =
   
       let clContext =
  
positive.code:                 printfn "Run"
                  this.HandleRun(commandQueue, a) |> ignore
  
              return! loop 0
              }
          loop 0)
  
  module Lib =
      let getNewVectorVectorElementwiseOp<'t1,'t2,'t3> (gpu:GPU) op =
          let kernelFun =
              <@ fun (range:_1D) (a1:array<'t1>) (a2:array<'t2>) (res:array<'t3>) ->
  
negative.code:             let i = range.GlobalID0
              buf.[i] <- buf.[i] * n @>
  
      let mxmQuadro () =
  
          let devices = Device.getDevices "*NVIDIA*" DeviceType.Gpu
          printfn "Device: %A" devices.[0]
          let gpu = GPU(devices.[0])
          let processors = Array.init 4 (fun _ -> gpu.GetNewProcessor ())
  
          let mSize = 3 * 1024
          let size = mSize * mSize
          let localWorkSize = 32
          let d = (new _2D(mSize, mSize, localWorkSize, localWorkSize))
  
          let aBlocks = Array.init 4 (fun _ -> Array.init size (fun _ -> 1))
          let bBlocks = Array.init 4 (fun _ -> Array.init size (fun _ -> 2))
          let resBlocks = Array.init 4 (fun _ -> Array.zeroCreate size)
  
          let _aBlocks = Array.init 4 (fun _ -> gpu.Allocate<_>(size))
          let _bBlocks = Array.init 4 (fun _ -> gpu.Allocate<_>(size))
          //let _res1Blocks = Array.init 4 (fun _ ->  gpu.Allocate<_>(size))
          let _resBlocks = Array.init 4 (fun _ ->  gpu.Allocate<_>(size))
  
          let mxm = Array.init 4 (fun _ -> Lib.getNewMxMAdd<_,_,_> gpu <@ (+) @> <@ (*) @>)
          let mam = Array.init 4 (fun _ -> Lib.getNewMAddM<   int> gpu <@ (+) @>)
  
          let barrier1 = Msg.CreateBarrierMessages 4
  
          processors
          |> Array.iteri (fun i p ->
              p.Post(Msg.CreateToGPUMsg(ToGPU<_>(aBlocks.[i], _aBlocks.[i])))
              p.Post(Msg.CreateToGPUMsg(ToGPU<_>(bBlocks.[i], _bBlocks.[i])))
              p.Post(Msg.CreateToGPUMsg(ToGPU<_>(resBlocks.[i], _resBlocks.[i])))
              p.Post(barrier1.[i])
              )
  
          for i in 0..1 do
              for j in 0..1 do
                  for k in 0..1 do
                      let mxm = mxm.[i * 2 + j]
                      let mam = mam.[i * 2 + j]
                      mxm processors.[i * 2 + j] d mSize _aBlocks.[i * 2 + k] _bBlocks.[k * 2 + j] _resBlocks.[i * 2 + j]
                      //mam processors.[i * 2 + j] d mSize _res1Blocks.[i * 2 + j] _res2Blocks.[i * 2 + j] _res2Blocks.[i * 2 + j]
  
          let barrier2 = Msg.CreateBarrierMessages 4
          Array.iteri2
              (fun i (p:MailboxProcessor<_>) b ->
                  p.Post(b)
              )
              processors
              barrier2
  
          processors
          |> Array.mapi (fun i p -> p.PostAndReply(fun ch -> Msg.CreateToHostMsg(ToHost<_>(_resBlocks.[i], resBlocks.[i], ch))))
  
          resBlocks
          |> Array.iter (fun x -> printfn "%A" x)
  
  
  
      let f1 () =
          let devices = Device.getDevices "*" DeviceType.Gpu
          printfn "Device: %A" devices.[0]
          let gpu = GPU(devices.[0])
  