{-# LANGUAGE FlexibleContexts #-}

-- | @futhark cuda@
module Futhark.CLI.CUDA (main) where

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

-- | Run @futhark cuda@.
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 CUDA"
  String
"Generate CUDA/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
compileCUDAAction FutharkConfig
fcfg CompilerMode
mode String
outpath) Prog KernelsMem
prog