{-# LANGUAGE FlexibleContexts #-}

-- | @futhark pyopencl@
module Futhark.CLI.PyOpenCL (main) where

import Futhark.Actions (compilePyOpenCLAction)
import Futhark.Compiler.CLI
import Futhark.Passes

-- | Run @futhark pyopencl@.
main :: String -> [String] -> IO ()
main :: String -> [String] -> IO ()
main = ()
-> [CompilerOption ()]
-> String
-> String
-> Pipeline SOACS GPUMem
-> (FutharkConfig
    -> () -> CompilerMode -> String -> Prog GPUMem -> FutharkM ())
-> String
-> [String]
-> IO ()
forall cfg rep.
cfg
-> [CompilerOption cfg]
-> String
-> String
-> Pipeline SOACS rep
-> (FutharkConfig
    -> cfg -> CompilerMode -> String -> Prog rep -> FutharkM ())
-> String
-> [String]
-> IO ()
compilerMain
  ()
  []
  String
"Compile PyOpenCL"
  String
"Generate Python + OpenCL code from optimised Futhark program."
  Pipeline SOACS GPUMem
gpuPipeline
  ((FutharkConfig
  -> () -> CompilerMode -> String -> Prog GPUMem -> FutharkM ())
 -> String -> [String] -> IO ())
-> (FutharkConfig
    -> () -> CompilerMode -> String -> Prog GPUMem -> FutharkM ())
-> String
-> [String]
-> IO ()
forall a b. (a -> b) -> a -> b
$ \FutharkConfig
fcfg () CompilerMode
mode String
outpath Prog GPUMem
prog ->
    Action GPUMem -> Prog GPUMem -> FutharkM ()
forall rep. Action rep -> Prog rep -> FutharkM ()
actionProcedure (FutharkConfig -> CompilerMode -> String -> Action GPUMem
compilePyOpenCLAction FutharkConfig
fcfg CompilerMode
mode String
outpath) Prog GPUMem
prog