{-# LANGUAGE FlexibleContexts #-}

-- | @futhark opencl@
module Futhark.CLI.OpenCL (main) where

import Futhark.Actions (compileOpenCLAction)
import Futhark.Compiler.CLI
import Futhark.Passes (gpuPipeline)

-- | Run @futhark opencl@
main :: String -> [String] -> IO ()
main :: String -> [String] -> IO ()
main = ()
-> [CompilerOption ()]
-> String
-> String
-> Pipeline SOACS KernelsMem
-> (FutharkConfig
    -> () -> CompilerMode -> String -> Prog KernelsMem -> FutharkM ())
-> String
-> [String]
-> IO ()
forall cfg lore.
cfg
-> [CompilerOption cfg]
-> String
-> String
-> Pipeline SOACS lore
-> (FutharkConfig
    -> cfg -> CompilerMode -> String -> Prog lore -> FutharkM ())
-> String
-> [String]
-> IO ()
compilerMain
  ()
  []
  String
"Compile OpenCL"
  String
"Generate OpenCL/C code from optimised Futhark program."
  Pipeline SOACS KernelsMem
gpuPipeline
  ((FutharkConfig
  -> () -> CompilerMode -> String -> Prog KernelsMem -> FutharkM ())
 -> String -> [String] -> IO ())
-> (FutharkConfig
    -> () -> CompilerMode -> String -> Prog KernelsMem -> FutharkM ())
-> String
-> [String]
-> IO ()
forall a b. (a -> b) -> a -> b
$ \FutharkConfig
fcfg () CompilerMode
mode String
outpath Prog KernelsMem
prog ->
    Action KernelsMem -> Prog KernelsMem -> FutharkM ()
forall lore. Action lore -> Prog lore -> FutharkM ()
actionProcedure (FutharkConfig -> CompilerMode -> String -> Action KernelsMem
compileOpenCLAction FutharkConfig
fcfg CompilerMode
mode String
outpath) Prog KernelsMem
prog