Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
a89c6718
Commit
a89c6718
authored
Sep 23, 2017
by
Sumit Sahrawat
Committed by
GitHub
Sep 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #714 from leftaroundabout/master
Enable RTS options
parents
76ce3b3f
52fbd3b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
ihaskell.cabal
ihaskell.cabal
+1
-1
Main.hs
main/Main.hs
+2
-0
Flags.hs
src/IHaskell/Flags.hs
+17
-1
IPython.hs
src/IHaskell/IPython.hs
+6
-0
No files found.
ihaskell.cabal
View file @
a89c6718
...
...
@@ -128,7 +128,7 @@ executable ihaskell
other-modules:
IHaskellPrelude
Paths_ihaskell
ghc-options: -threaded
ghc-options: -threaded
-rtsopts
-- Other library packages from which modules are imported.
default-language: Haskell2010
...
...
main/Main.hs
View file @
a89c6718
...
...
@@ -113,6 +113,8 @@ parseKernelArgs = foldl' addFlag defaultKernelSpecOptions
kernelSpecOpts
{
kernelSpecDebug
=
True
}
addFlag
kernelSpecOpts
(
GhcLibDir
libdir
)
=
kernelSpecOpts
{
kernelSpecGhcLibdir
=
libdir
}
addFlag
kernelSpecOpts
(
RTSFlags
rts
)
=
kernelSpecOpts
{
kernelSpecRTSOptions
=
rts
}
addFlag
kernelSpecOpts
(
KernelspecInstallPrefix
prefix
)
=
kernelSpecOpts
{
kernelSpecInstallPrefix
=
Just
prefix
}
addFlag
kernelSpecOpts
KernelspecUseStack
=
...
...
src/IHaskell/Flags.hs
View file @
a89c6718
...
...
@@ -31,6 +31,8 @@ data Args = Args IHaskellMode [Argument]
data
Argument
=
ConfFile
String
-- ^ A file with commands to load at startup.
|
OverwriteFiles
-- ^ Present when output should overwrite existing files.
|
GhcLibDir
String
-- ^ Where to find the GHC libraries.
|
RTSFlags
[
String
]
-- ^ Options for the GHC runtime (e.g. heap-size limit
-- or number of threads).
|
KernelDebug
-- ^ Spew debugging output from the kernel.
|
Help
-- ^ Display help text.
|
Version
-- ^ Display version text.
...
...
@@ -96,6 +98,20 @@ help mode = showText (Wrap 100) $ helpText [] HelpFormatAll $ chooseMode mode
ghcLibFlag
::
Flag
Args
ghcLibFlag
=
flagReq
[
"ghclib"
,
"l"
]
(
store
GhcLibDir
)
"<path>"
"Library directory for GHC."
ghcRTSFlag
::
Flag
Args
ghcRTSFlag
=
flagReq
[
"use-rtsopts"
]
storeRTS
"
\"
<flags>
\"
"
"Runtime options (multithreading etc.). See `ghc +RTS -?`."
where
storeRTS
allRTSFlags
(
Args
mode
prev
)
=
fmap
(
Args
mode
.
(
:
prev
)
.
RTSFlags
)
.
parseRTS
.
words
$
filter
(
/=
'"'
)
allRTSFlags
parseRTS
(
"+RTS"
:
fs
)
-- Ignore if this is included (we already wrap
=
parseRTS
fs
-- the ihaskell-kernel call in +RTS <flags> -RTS anyway)
parseRTS
[
"-RTS"
]
=
Right
[]
parseRTS
(
"-RTS"
:
_
)
-- Evil injection of extra arguments? Unlikely, but...
=
Left
"Adding non-RTS options to --use-rtsopts not permitted."
parseRTS
(
f
:
fs
)
=
(
f
:
)
<$>
parseRTS
fs
parseRTS
[]
=
Right
[]
kernelDebugFlag
::
Flag
Args
kernelDebugFlag
=
flagNone
[
"debug"
]
addDebug
"Print debugging output from the kernel."
where
...
...
@@ -125,7 +141,7 @@ store constructor str (Args mode prev) = Right $ Args mode $ constructor str : p
installKernelSpec
::
Mode
Args
installKernelSpec
=
mode
"install"
(
Args
InstallKernelSpec
[]
)
"Install the Jupyter kernelspec."
noArgs
[
ghcLibFlag
,
kernelDebugFlag
,
confFlag
,
installPrefixFlag
,
helpFlag
,
kernelStackFlag
]
[
ghcLibFlag
,
ghcRTSFlag
,
kernelDebugFlag
,
confFlag
,
installPrefixFlag
,
helpFlag
,
kernelStackFlag
]
kernel
::
Mode
Args
kernel
=
mode
"kernel"
(
Args
(
Kernel
Nothing
)
[]
)
"Invoke the IHaskell kernel."
kernelArg
...
...
src/IHaskell/IPython.hs
View file @
a89c6718
...
...
@@ -45,6 +45,7 @@ import StringUtils (replace, split)
data
KernelSpecOptions
=
KernelSpecOptions
{
kernelSpecGhcLibdir
::
String
-- ^ GHC libdir.
,
kernelSpecRTSOptions
::
[
String
]
-- ^ Runtime options to use.
,
kernelSpecDebug
::
Bool
-- ^ Spew debugging output?
,
kernelSpecConfFile
::
IO
(
Maybe
String
)
-- ^ Filename of profile JSON file.
,
kernelSpecInstallPrefix
::
Maybe
String
...
...
@@ -54,6 +55,8 @@ data KernelSpecOptions =
defaultKernelSpecOptions
::
KernelSpecOptions
defaultKernelSpecOptions
=
KernelSpecOptions
{
kernelSpecGhcLibdir
=
GHC
.
Paths
.
libdir
,
kernelSpecRTSOptions
=
[
"-M3g"
,
"-N2"
]
-- Memory cap 3 GiB,
-- multithreading on two processors.
,
kernelSpecDebug
=
False
,
kernelSpecConfFile
=
defaultConfFile
,
kernelSpecInstallPrefix
=
Nothing
...
...
@@ -191,6 +194,9 @@ installKernelspec replace opts = void $ do
Nothing
->
[]
Just
file
->
[
"--conf"
,
file
])
++
[
"--ghclib"
,
kernelSpecGhcLibdir
opts
]
++
(
case
kernelSpecRTSOptions
opts
of
[]
->
[]
rtsOpts
->
"+RTS"
:
kernelSpecRTSOptions
opts
++
[
"-RTS"
])
++
[
"--stack"
|
kernelSpecUseStack
opts
]
let
kernelSpec
=
KernelSpec
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment