Via the Theano FAQ, Theano automatically adds -march=native. This breaks the cached compiled modules when I run it on another older CPU, e.g. with such an error:
PROGRAM DEFECTIVE (TERMINATED BY SIGNAL):
Illegal instruction
Creating stack trace (innermost first):
#2 /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x2b0304efc4b0]
#3 /u/bozheniuk/.theano/compiledir_Linux-4.4--generic-x86_64-with-Ubuntu-16.04-xenial-x86_64-2.7.12-64/lazylinker_ext/lazylinke
r_ext.so(+0x4d2a) [0x2b030fe44d2a]
#4 /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x8a51) [0x2b0304453961]
#5 /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x85c) [0x2b030458904c]
...
How can I disable that, such that it does not automatically adds -march=native?
Ok, this seems to be the way:
In ~/.theanorc, add e.g. this (for a CPU which is old enough; see here for a list):
[gcc]
cxxflags=-march=core2
If you get this warning:
WARNING (theano.gof.cmodule): WARNING: your Theano flags `gcc.cxxflags` specify an `-march=X` flags.
It is better to let Theano/g++ find it automatically, but we don't do it now
It probably means that you have Theano 0.8. Theano >=0.9 should not print this warning anymore.
Related
I saw a possible solution for an utf8 problem here: Read file with UTF-8 in Haskell as IO String. I wanted to try that out, but I'm having a problem I can't resolve.
When I run the command cabal v2-install encoding --lib almost everything works but fails in the end with these lines:
[8 of 8] Compiling Main ( /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/setup.hs, /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/Main.o )
Linking /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/setup ...
Configuring encoding-0.8.5...
Preprocessing library for encoding-0.8.5..
arithmetic overflow
cabal: Failed to build encoding-0.8.5. See the build log above for details.
If I add --verbose=3 to the command line the last few output lines are
creating dist/build/Data
creating dist/build/Data/Encoding
Data/Encoding/ISO88592.hs generated from mapping
Data/Encoding/ISO88592.mapping
arithmetic overflow
CallStack (from HasCallStack):
die', called at ./Distribution/Client/ProjectOrchestration.hs:1041:55 in main:Distribution.Client.ProjectOrchestration
cabal: Failed to build
encoding-0.8.5-aa69e7dd952ebb6bcbe7b0947ad7f87838ecbfac327d0aa020c7f7f0f19b3e18.
I'm using cabal 3.2 and GHC 8.10.2 under Linux Mint 20.
I've looked "all over the place" for a solution, and the only trace of something similar is that the error is confirmed in Gentoo's Bugzilla.
Any help is appreciated!
This is apparently a bug in the library encoding (I could reproduce it), and there's a fix available as a PR on the source repository:
https://github.com/dmwit/encoding/pull/11
This question is about linux kernel 4.10.
Loading an out-of-tree LKM causes kernel to print a warning:
module: loading out-of-tree module taints kernel.
This raises from this check in module.c:
if (!get_modinfo(info, "intree")) {
Reading get_modinfo it seams that "intree" is just a a magic-string livnig inside the .ko file.
Running readelf on a random LKM I found in my system shows this:
readelf -a imon.ko | grep intree
161: 00000000000006c0 9 OBJECT LOCAL DEFAULT 13 __UNIQUE_ID_intree1
While looking for intree in a simple, custom hello_world LKM returns no results.
Is this actually the case?
How are some modules marked as being in-tree? Is it done by adding a macro to the module (like MODULE_LICENCE), or by building the module in a specific way or something else?
In short, the build system contrives to add the line MODULE_INFO(intree, "Y"); to the "modulename.mod.c" file if and only if the module is being built intree.
There is an obvious way to fool the system by adding that line to one of your module's regular ".c" files, but I'm not sure why you'd want to.
Longer version....
External modules are normally built with a command similar to this:
$ make M=`pwd` modules
or the old syntax:
$ make SUBDIRS=`pwd` modules
The presence of a non-empty M or SUBDIRS causes the kernel's top-level "Makefile" to set the KBUILD_EXTMOD variable. It won't be set for a normal kernel build.
For stage 2 of module building (when the message "Building modules, stage 2" is output), make runs the "scripts/Makefile.modpost" makefile. That runs scripts/mod/modpost with different options when KBUILD_EXTMOD is set. In particular, the -I option is used when KBUILD_EXTMOD is set.
Looking at the source for modpost in "scripts/mod/modpost.c", the external_module variable has an initial value of 0, but the -I option sets it to 1. The function add_intree_flag() is called with the second parameter is_intree set to !external_module. The add_intree_flag() function writes MODULE_INFO(intree, "Y"); to the "modulename.mod.c" file if and only if its is_intree parameter is true.
So the difference between intree modules and external modules is the presence of the MODULE_INFO(intree, "Y"); macro call in the "modulename.mod.c" file. This gets compiled to "modulename.mod.o" and linked with the module's other object files to form the "modulename.ko" file.
I have some familiarity with Haskell, the language, but not so much with the toolchain. (I played around with Haskell before cabal and stack existed.) I'm told that stack is the tool I should be using to manage Haskell projects. I'm trying to learn the haste library, and I'm getting stymied on the first tutorial I've tried, because I can't get hplayground installed. I created a stack project; my stack.yaml has
extra-deps:
- ghc-simple-0.3
- haste-compiler-0.5.3
- shellmate-0.2.3
- haste-perch-0.1.0.9
- hplayground-0.1.3.1
and my .cabal file has hplayground listed in the build-depends. But when I run stack build, I get these errors:
Configuring haste-perch-0.1.0.9...
Building haste-perch-0.1.0.9...
Preprocessing library haste-perch-0.1.0.9...
Haste/Perch.hs:17:15: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
Haste/App/Perch.hs:18:15: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
[1 of 2] Compiling Haste.App.Perch ( Haste/App/Perch.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Haste/App/Perch.o )
Haste/App/Perch.hs:61:15: Not in scope: ‘newTextElem’
Haste/App/Perch.hs:71:9:
Not in scope: ‘setAttr’
Perhaps you meant ‘jsSetAttr’ (imported from Haste.App)
Haste/App/Perch.hs:76:15:
Not in scope: ‘newElem’
Perhaps you meant one of these:
‘nelem’ (line 75), ‘notElem’ (imported from Prelude)
and a whole lot of similar errors. Any thoughts on what I'm doing wrong?
More broadly: what is a fast, easy way to get up and running with haste for someone who's not experienced with the Haskell toolchain?
Haste's event APIs got overhauled between the 0.4 and 0.5 series, and HPlayground is still on 0.4. If you want to use it, you will unfortunately have to fall back to 0.4 until HPlayground gets patched for 0.5.
For getting started in general, you should install the pre-build binaries if you're on a non-Linux platform (and probably if you're on a Linux platform as well, since you get man-pages and other niceties); the build process can be tricky and is prone to errors.
Once you've done that, you can refer to the docs and resources page on haste-lang.org, which contains links to API docs, video tutorials, source code examples and more.
Once you have installed ghc and cabal installed you will need to install the haste compiler as follows ( from http://haste-lang.org/downloads/ ):
$ cabal update
$ cabal install haste-compiler
$ haste-boot
After doing this, "hastec" ( the haste compiler ) should be available to use to compile haskell to javascript. In addition, "haste-cabal" ( the haste version of cabal ) should be available to use to install libraries such as haste-perch for use in your programs.
The readme file for haste-perch (https://github.com/agocorona/haste-perch) contains the instructions for installing haste-perch. Those instructions use "haste-inst" to install haste-perch but "haste-inst" is obsolete ( and no longer exists ). Use the modified instructions below to install haste-perch:
>git clone http://github.com/agocorona/haste-perch.git
>cd haste-perch
>haste-cabal install
I was able to install haste-perch and successfully build the example that it came with.
I also tried building hplayground but ran into compile problems that looked as if they were due to the code not being updated to use haste 0.5 . For example, "OnClick" was a valid identifier in earlier versions of haste but not anymore:
src/Haste/HPlay/View.hs:820:45:
Not in scope: data constructor ‘OnClick’
Perhaps you meant ‘Click’ (line 1017)
I am attempting to set up a new Stack project on NixOS with GHCJS as the compiler following the instructions at http://docs.haskellstack.org/en/stable/ghcjs.html
I have included in my stack.yaml file the following lines of code (all on one line because tab spaces seem to give issues):
# Compiler specifying the GHCJS compiler for this project (using improved base).
compiler: ghcjs-0.2.0.20151230.3_ghc-7.10.2
compiler-check: match-exact
setup-info:
ghcjs: source:
ghcjs-0.2.0.20151230.3_ghc7.10.2:
url: "https://github.com/nrolland/ghcjs/releases/download/v.0.2.0.20151230.3/ghcjs-0.2.0.20151230.3.tar.gz"
and I have retrieved the following error message when I ran stack setup
Could not parse '/home/lorkaan/pandocJS/stack.yaml':
InvalidYaml (Just (YamlParseException {yamlProblem = "mapping values are not allowed in this context", yamlContext = "", yamlProblemMark = YamlMark {yamlIndex = 487, yamlLine = 12, yamlColumn = 17}}))
See https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md.
Additionally, I tried removing the setup-info field because Stack was complaining about it, leaving my stack.yaml file like:
# Compiler specifying the GHCJS compiler for this project (using improved base).
compiler: ghcjs-0.2.0.20151230.3_ghc-7.10.2
compiler-check: match-exact
which produces this output with the stack setup command:
Warning: /home/lorkaan/pandocJS/stack.yaml: Unrecognized field in ProjectAndConfigMonoid: compiler
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
The following executables are missing and must be installed: make
Does anybody have any idea why this would be happening?
the first error is because of a basic syntax error in your YAML configuration. The correct version would be:
setup-info:
ghcjs:
source:
ghcjs-0.2.0.20151230.3_ghc7.10.2:
url: "https://github.com/nrolland/ghcjs/releases/download/v.0.2.0.20151230.3/ghcjs-0.2.0.20151230.3.tar.gz"
The second error is because of exactly what it says: you are lacking the make utility. You need to use your Linux distribution's package management system to install make. Since I don't know which distribution you are on, I can only recommend simply executing the $ make command and seeing if the environment is smart enough to point out which package it can be found in. Ubuntu typically does that. Then it's only a matter of apt-get install-ing the package, or possibly yum install-ing on e.g. CentOS and Fedora, etc.
P.S. questions like yours normally get a downvote for not having shown sufficient effort in diagnosing the problem (or for putting 2 totally separate problems under a single question) but I'm giving you the benefit of the doubt and just hoping you'll be tidier next time.
This is my stack.yaml file declaring hspec as a extra dependency:
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: lts-3.8
# Local packages, usually specified by relative directory name
packages:
- '.'
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- hspec-2.2.0
when I run stack solver it says there is no change to be done:
root#5d7daa2aec0a:/src/test_stack/a-test/src# stack solver
This command is not guaranteed to give you a perfect build plan
It's possible that even with the changes generated below, you will still need to do some manual tweaking
Asking cabal to calculate a build plan, please wait
No needed changes found
To automatically modify your stack.yaml file, rerun with '--modify-stack-yaml'
this is my source file (only to check that I could use Hspec with stack):
module Main where
import Test.Hspec
main :: IO ()
main = do
putStrLn "hello world"
and when I run stack build I get:
2015-10-05 22:24:08.450413: [warn] Could not find module `Test.Hspec' #(stack_Bp003b8iWaELtdr693pSPs:Stack.Build.Execute src/Stack/Build/Execute.hs:1241:35)
I thought stack solver was ensuring that extra dependencies are ok.
What I am doing wrong ?
It's the first time I use stack.
While stack replaces cabal-install, the command line tool for building and installing packages, it still uses the Cabal packaging infrastructure. In particular, that means projects built with stack are still Cabal-compatible packages with .cabal files, and all of their dependencies should be listed in the build-depends section of the .cabal file with appropriate version ranges. That holds even if the dependency is also specified in the stack.yaml file extra-deps field, as that field serves a different purpose (namely, giving stack an exact version to use when building the package).