These are chat archives for symengine/symengine

29th
Jun 2015
Abinash Meher
@abinashmeher999
Jun 29 2015 12:30
@isuruf I have a small question. I went through test_cwrapper.c, and all I found were printf statements. In that case, how are we ensuring that we are getting the expected results?
Sumith Kulal
@Sumith1896
Jun 29 2015 12:43
That's a worry for me too, I have not updated that to Catch
Abinash Meher
@abinashmeher999
Jun 29 2015 12:45
I think Catch should work both with C and C++.
Sumith Kulal
@Sumith1896
Jun 29 2015 12:46
Yes it should, I have not found how to fix the builds yet
Abinash Meher
@abinashmeher999
Jun 29 2015 12:48
I see. There are mostly assignments in the file. I think it tests only for runtime errors not logical ones. So if an error arises it will exit. That might be the way they are being tested right now.
Sumith Kulal
@Sumith1896
Jun 29 2015 12:49
Yes, maybe even the rcp tests are the same I think
When I add -stdlib=libc++ and try to build locally, I still get an error
/home/sumith/anaconda/bin/clang++ -std=c++11 -Wall -Wextra -fPIC -O3
  -march=native -ffast-math -funroll-loops -Wno-unused-parameter
  -stdlib=libc++ -o
These are the compiler options
Does anything look fishy here?
Isuru Fernando
@isuruf
Jun 29 2015 12:58
@abinashmeher999, those tests needs to be fixed
Abinash Meher
@abinashmeher999
Jun 29 2015 12:59
Oh ok. For now, if I want to test them do I run the executable test_cwrapper, then?
Isuru Fernando
@isuruf
Jun 29 2015 13:01
you can convert them into tests with asserts on. We'll figure out how to use it with catch later on
Abinash Meher
@abinashmeher999
Jun 29 2015 13:01
@Sumith1896 I am not all that familiar with compiler options. So, these don't make much sense to me either.
Sumith Kulal
@Sumith1896
Jun 29 2015 13:03
Okay, no problem
Abinash Meher
@abinashmeher999
Jun 29 2015 13:04
I see. Thanks @isuruf .
Isuru Fernando
@isuruf
Jun 29 2015 13:04
@Sumith1896, have you installed the libc++ library?
Sumith Kulal
@Sumith1896
Jun 29 2015 13:07
Let me check
Sumith Kulal
@Sumith1896
Jun 29 2015 13:13
@isuruf There are libc++.so etc
I remember installing, I don't know how to check.
Isuru Fernando
@isuruf
Jun 29 2015 13:14
What OS are you running?
Sumith Kulal
@Sumith1896
Jun 29 2015 13:15
Linux, Ubuntu
Isuru Fernando
@isuruf
Jun 29 2015 13:15
Try apt-get install libc++-dev
Sumith Kulal
@Sumith1896
Jun 29 2015 13:18
Installed some files
But the build still breaks
Isuru Fernando
@isuruf
Jun 29 2015 13:18
Can you clean the repo, run it again and tell me what the error is?
Isuru Fernando
@isuruf
Jun 29 2015 13:21
Okay. That one is expected
Sumith Kulal
@Sumith1896
Jun 29 2015 13:21
Recompile gmp or somthing else?
Isuru Fernando
@isuruf
Jun 29 2015 13:22
you have a GMP compiled with libstdc++ and now you are trying to link with libc++
yes
Sumith Kulal
@Sumith1896
Jun 29 2015 13:24
I did this in my gmp directory
CC=clang ./configure
make CXXFLAGS="-stdlib=libc++"
Is there separate gmpxx does that need a recompilation ?
Isuru Fernando
@isuruf
Jun 29 2015 13:26
./configure --enable-cxx
you will also need, CXX=clang++
Sumith Kulal
@Sumith1896
Jun 29 2015 13:30
sudo make CXXFLAGS="-stdlib=libc++" install is not working
I get the following error
make[2]: Entering directory `/home/sumith/Downloads/gmp-6.0.0'
make[3]: Entering directory `/home/sumith/Downloads/gmp-6.0.0'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   libgmp.la libgmpxx.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libgmp.so.10.2.0 /usr/local/lib/libgmp.so.10.2.0
libtool: install: (cd /usr/local/lib && { ln -s -f libgmp.so.10.2.0 libgmp.so.10 || { rm -f libgmp.so.10 && ln -s libgmp.so.10.2.0 libgmp.so.10; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libgmp.so.10.2.0 libgmp.so || { rm -f libgmp.so && ln -s libgmp.so.10.2.0 libgmp.so; }; })
libtool: install: /usr/bin/install -c .libs/libgmp.lai /usr/local/lib/libgmp.la
libtool: install: error: cannot install `libgmpxx.la' to a directory not ending in /home/sumith/anaconda/bin/clang/lib
make[3]: *** [install-libLTLIBRARIES] Error 1
make[3]: Leaving directory `/home/sumith/Downloads/gmp-6.0.0'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/sumith/Downloads/gmp-6.0.0'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/sumith/Downloads/gmp-6.0.0'
make: *** [install] Error 2
Isuru Fernando
@isuruf
Jun 29 2015 13:32
give --prefix=/home/sumith/anaconda/bin/clang/lib to configure
Sumith Kulal
@Sumith1896
Jun 29 2015 13:35
cannot create directory ‘/home/sumith/anaconda/bin/clang’: Not a directory
here clang is a binary, not a folder
/lib cannot be created
Sudhanshu Mishra
@debugger22
Jun 29 2015 13:38
Try creating it temporarily
by renaming clang to something else
Isuru Fernando
@isuruf
Jun 29 2015 13:38
do a make clean, create a folder /home/sumith/gmp and then give --prefix=/home/sumith/gmp
Sudhanshu Mishra
@debugger22
Jun 29 2015 13:38
just a shot
I've no clue
Sumith Kulal
@Sumith1896
Jun 29 2015 13:43
gmp compiles successfully
But the build still fails
Isuru Fernando
@isuruf
Jun 29 2015 13:43
You are still linking with the system gmp
Sumith Kulal
@Sumith1896
Jun 29 2015 13:44
Yes that's the problem
How do I change that?
Sumith Kulal
@Sumith1896
Jun 29 2015 13:58
Cool :+1: compiles
Isuru Fernando
@isuruf
Jun 29 2015 14:01
great
Sumith Kulal
@Sumith1896
Jun 29 2015 14:01
So now I basically have to add -stdlib=libc++ to the flags to test on travis
Isuru Fernando
@isuruf
Jun 29 2015 14:02
:D It's not that easy. You will have to go through all the things you did in travis as well
Sumith Kulal
@Sumith1896
Jun 29 2015 14:03
Ohh cool, I never played with Travis configs before
Good to try
Let's see, I'll try for sometime and ping you in the commit maybe
Thanks for all the help now
Isuru Fernando
@isuruf
Jun 29 2015 14:04
Great. You can try in the fork as well. Just upload to a branch in the fork and travis will run the tests for you
Sumith Kulal
@Sumith1896
Jun 29 2015 14:04
Yes, I recently got that activated. Very useful and time saver too.
Sumith Kulal
@Sumith1896
Jun 29 2015 14:13
Also @isuruf
merge other PRs whenever ready
Rebasing my PR is not a huge task at all, I am willing to do it later.
Ondřej Čertík
@certik
Jun 29 2015 15:32
@Sumith1896 my other PR modifies the tests, so I would prefer to have Catch in there and working, so that we can build on top of that. I think we are really close to finish the Catch PR.
Sumith Kulal
@Sumith1896
Jun 29 2015 15:32
Cool, I got it figured out in locally, thanks to @isuruf
We need to repeat that in Travis
Ondřej Čertík
@certik
Jun 29 2015 15:33
@Sumith1896 so is the fix to enable libc++ for clang, and then reinstall gmp in this particular case?
Sumith Kulal
@Sumith1896
Jun 29 2015 15:33
Yes, we installed libc++-dev
Then recompile gmp using these and use that.
Sorry for being vague, recompile gmp using clang and libc++ and use that in SymEngine
Ondřej Čertík
@certik
Jun 29 2015 15:34
Then let's get it done. This will btw also fix #486, since I am pretty sure it only fails due to some incompatibility of libstdc++ with clang, so if we use libc++, that should fix it.
Sumith Kulal
@Sumith1896
Jun 29 2015 15:35
Cool :)
Ondřej Čertík
@certik
Jun 29 2015 15:36
@Sumith1896 please ping me once you push in some patches into the PR. I can have a look at them if they are going to work. Of course Travis will tell you as well, it's just been pretty slow today for some reason.
Isuru Fernando
@isuruf
Jun 29 2015 15:37
@certik, for sympify, how do I check that the python object is a sage object or a sympy object without importing the modules?
Ondřej Čertík
@certik
Jun 29 2015 15:37
why would you need to check that?
Isuru Fernando
@isuruf
Jun 29 2015 15:38
to convert them to SymEngine objects in sympify
Ondřej Čertík
@certik
Jun 29 2015 15:38
I would call the _sympy_ method on it, if it has it, it's from Sage or any other program. If it doesn't have it, and it is an instance of Add/Mul etc. it's a sympy object.
Isuru Fernando
@isuruf
Jun 29 2015 15:39
I'm going to implement a _symengine_ method in Sage. So, I'll check for that
Ondřej Čertík
@certik
Jun 29 2015 15:39
I think that will be a faster solution. But you can also just convert to sympy first and then to symengine.
Sumith Kulal
@Sumith1896
Jun 29 2015 15:43
Where is the distinction made between clang and gcc in travis files?
Isuru Fernando
@isuruf
Jun 29 2015 15:51
Btw, users without sympy will get an unhelpful message since if we can't sympify it earlier, we are searching with sympy2symengine
@Sumith1896, we haven't made such a distinction.
You can check for it using the CC variable. Don't check that it is equal to clang, check that it has clang as a prefix (or a substring)
@certik, in sage, this is used, if 'sympy' in R.__module__:
Ondřej Čertík
@certik
Jun 29 2015 16:06
@Sumith1896 it's in the compiler: gcc or compiler: clang part.
Sumith Kulal
@Sumith1896
Jun 29 2015 16:07
@certik What combinations are possible out of the following?
Linux, gcc; Linux, clang; OSX, gcc; OSX; clang
All?
Ondřej Čertík
@certik
Jun 29 2015 16:08
Yes, that should be it.
@isuruf I see. Finish it up in a way that you think is the best for now, and we can see later. I don't have an opinion yet what the best way in the long term is. I like the _sympy_, _sage_ and _symengine_ methods, I think that's the way to go for sure to do low level conversion between the systems. Then it 's just a matter of hooking it up and make it automatic, there I think Sage needs to check for the _sage_ method, and SymEngine needs to check for the _symengine_ method.
@bluescarni very nice blog post (http://bluescarni.github.io/memory-friendly-data-structures-in-piranha-13.html), thanks again for writing this up. Very informative. I wonder if using 64bit integers instead of 128bit would be even faster for some applications?
Sumith Kulal
@Sumith1896
Jun 29 2015 16:14
@isuruf Instead of that would CC not equal to gcc give clang?
Ondřej Čertík
@certik
Jun 29 2015 16:14
The other optimization, as we talked about, is to do what Flint does --- use the pointer to mpz_t and use the upper bit to decide whether it is a pointer or a machine 64 bit integer. Not fully c++ standard compliant, but I think it is easy to check with macros that things are aligned properly, thus I think it is safe, as we talked about.
Isuru Fernando
@isuruf
Jun 29 2015 16:15
@Sumith1896, CC could be equal to gcc or gcc-4.8 etc.
Sumith Kulal
@Sumith1896
Jun 29 2015 16:15
Oh cool
@certik Have played with Flint before?
I think some of your previous works had that
The one I was using to try out Piranha
Ondřej Čertík
@certik
Jun 29 2015 16:19
@Sumith1896 I played with Flint. I think Piranha is faster and more general. (Also FLINT is GPL licensed, while Piranha will be LGPL as @bluescarni mentioned above, thus I don't mind even depending on it eventually.)
Sumith Kulal
@Sumith1896
Jun 29 2015 16:20
Cool
Isuru Fernando
@isuruf
Jun 29 2015 16:20
@certik, did you have some time to look at CMake on Sage?
Ondřej Čertík
@certik
Jun 29 2015 16:21
@isuruf let me look at it right away.
Can you post me the links to the spkg's to install into Sage? Which version of Sage should I use?
Can I use binary Sage, or do I need to install from source?
Isuru Fernando
@isuruf
Jun 29 2015 16:22
Can you do development work with binary Sage?
Ondřej Čertík
@certik
Jun 29 2015 16:24
I think so.
I have Sage 6.5 compiled from source as well.
send me the links to spkg to install, let me try it.
Isuru Fernando
@isuruf
Jun 29 2015 16:28
Extract this .tar.gz into the sage root folder and do ./sage -i -c cmake
https://drive.google.com/file/d/0B1xdAm0dyMndWV9WWHR2eWZYNm8/view?usp=sharing
You don't have to upgrade to test for now. (Upgrading to 6.8.beta5 is going to take some time,)
Ondřej Čertík
@certik
Jun 29 2015 16:33
The stupid mac unpacks it. Btw, I think you should name it .spkg, shouldn't you?
Isuru Fernando
@isuruf
Jun 29 2015 16:34
That's just a tarball I made for you to try it out. Correct way would be to use my git branch, which is based on latest develop branch
Ondřej Čertík
@certik
Jun 29 2015 16:34
I see
It's building now.
Sumith Kulal
@Sumith1896
Jun 29 2015 16:35
Also I need to change only install_travis right?
Ondřej Čertík
@certik
Jun 29 2015 16:35
If I want to try out your branch, what sage commands do I need to execute?
Isuru Fernando
@isuruf
Jun 29 2015 16:38
git trac checkout 18078
make
sage -i -c cmake
Abinash Meher
@abinashmeher999
Jun 29 2015 16:38
@Sumith1896 You might want to change test_travis too, if there are any tests you want to add when travis builds
Sumith Kulal
@Sumith1896
Jun 29 2015 16:39
The compiler flags are fed in test travis so I need to change that I think
Abinash Meher
@abinashmeher999
Jun 29 2015 16:41
Are you changing the compiler flags only?
Sumith Kulal
@Sumith1896
Jun 29 2015 16:42
I also have to install libc++and compile gmp in different way for clang only
If I am getting this right.
So even install_travis needs amendment
Abinash Meher
@abinashmeher999
Jun 29 2015 16:45
I guess you will have to. I see some compiler flags have been set here. https://github.com/sympy/symengine/blob/master/bin/test_travis.sh#L129
Isuru Fernando
@isuruf
Jun 29 2015 16:45
This is the easiest way
git trac checkout 18078
make
sage -i -c cmake
Abinash Meher
@abinashmeher999
Jun 29 2015 16:48
@Sumith1896 Keep all the installation tasks in install_travis. And the build related tasks in test_travis. So you might want to install libc++ in install_travis and compile gmp in test_travis.
Isuru Fernando
@isuruf
Jun 29 2015 16:51
Compiling gmp should be done in install_travis
Ondřej Čertík
@certik
Jun 29 2015 16:52
That's a known issue. You have to use the tricks from https://github.com/hashdist/hashstack/blob/72624e92f5df7d3565afe66871c402769498892b/pkgs/cmake.yaml, i.e. it looks like you are missing unset MACOSX_DEPLOYMENT_TARGET
Isuru Fernando
@isuruf
Jun 29 2015 16:55
Will do that. Was it set by you or sage?
Abinash Meher
@abinashmeher999
Jun 29 2015 16:55
@isuruf Is that because only symengine builds are set in test_travis? Like install_travis sets up the environment kind of?
Isuru Fernando
@isuruf
Jun 29 2015 16:55
@abinashmeher999, yes
Ondřej Čertík
@certik
Jun 29 2015 16:57
@isuruf you have to set it, otherwise it fails with the error I posted.
Isuru Fernando
@isuruf
Jun 29 2015 16:58
I thought you have to unset it?
Ondřej Čertík
@certik
Jun 29 2015 16:59
Yes, you have to unset it.
Isuru Fernando
@isuruf
Jun 29 2015 17:01
Out of curiosity, was it you who set the variable to 10.9 or was it sage?
Ondřej Čertík
@certik
Jun 29 2015 17:03
Oh, that was Sage probably.
I have OS X 10.10
Ok, after unsetting it, I get the following error: https://gist.github.com/certik/19515580755ae6a9388d
That's also a known error --- the curl library that's embedded inside cmake doesn't build with gcc. You have to build the newest curl yourself, and tell cmake to use it, see the Hashstack link I sent.
Isuru Fernando
@isuruf
Jun 29 2015 17:09
Okay. I will do that.
Ondřej Čertík
@certik
Jun 29 2015 17:11
Ping me when you have updated packages.
I'll update to your git in the meantime.
It says "git trac" not a git command.
How do I check it out?
Isuru Fernando
@isuruf
Jun 29 2015 17:13
It's a sage extension to git for use with trac. https://github.com/sagemath/git-trac-command
Ondřej Čertík
@certik
Jun 29 2015 17:13
do I just put it into my path?
Isuru Fernando
@isuruf
Jun 29 2015 17:14
yes
Ondřej Čertík
@certik
Jun 29 2015 17:16
Ok, installed it and it fails:
certik@pn1282459:~/ext/sage-6.5(develop)$ git trac checkout 18078
Loading ticket #18078...
Checking out Trac #18078 remote branch u/isuruf/cmake_optional_package -> local branch t/18078/cmake_optional_package...
Traceback (most recent call last):
  File "/Users/certik/bin/git-trac", line 18, in <module>
    cmdline.launch()
  File "/Users/certik/repos/git-trac-command/git_trac/cmdline.py", line 209, in launch
    app.checkout(args.ticket_or_branch, args.branch_name)
  File "/Users/certik/repos/git-trac-command/git_trac/app.py", line 115, in checkout
    self._checkout_ticket(int(ticket_or_branch), branch_name)
  File "/Users/certik/repos/git-trac-command/git_trac/app.py", line 139, in _checkout_ticket
    self.repo.checkout_new_branch(ticket.branch, branch)
  File "/Users/certik/repos/git-trac-command/git_trac/git_repository.py", line 123, in checkout_new_branch
    self.git.fetch('trac', remote)
  File "/Users/certik/repos/git-trac-command/git_trac/git_interface.py", line 341, in meth
    return self.execute(git_cmd, *args, **kwds)
  File "/Users/certik/repos/git-trac-command/git_trac/git_interface.py", line 328, in execute
    popen_stderr=subprocess.PIPE)
  File "/Users/certik/repos/git-trac-command/git_trac/git_interface.py", line 263, in _run
    raise GitError(result)
git_trac.git_error.GitError: git returned with non-zero exit code (128) when executing "git fetch trac u/isuruf/cmake_optional_package"
    STDERR: fatal: 'trac' does not appear to be a git repository
    STDERR: fatal: Could not read from remote repository.
    STDERR: 
    STDERR: Please make sure you have the correct access rights
    STDERR: and the repository exists.
Isuru Fernando
@isuruf
Jun 29 2015 17:18
git remote add trac git://trac.sagemath.org/sage.git
Ondřej Čertík
@certik
Jun 29 2015 17:21
It works!
Now I am doing make.
And it failed...
certik@pn1282459:~/ext/sage-6.5(develop)$ git trac checkout 18078
Loading ticket #18078...
Checking out Trac #18078 remote branch u/isuruf/cmake_optional_package -> local branch t/18078/cmake_optional_package...
Local branch already exists. Use "git trac pull" to get updates.
certik@pn1282459:~/ext/sage-6.5(t/18078/cmake_optional_package)$ make
./bootstrap -d
rm -rf config configure build/Makefile-auto.in
./bootstrap: line 29: aclocal: command not found
Bootstrap failed, downloading required files instead.
Attempting to download package configure-99.tar.gz from mirrors
Downloading the Sage mirror list
Searching fastest mirror
Traceback (most recent call last):
  File "/Users/certik/ext/sage-6.5/src/bin/sage-download-file", line 457, in <module>
    tarball.download()
  File "/Users/certik/ext/sage-6.5/src/bin/sage-download-file", line 392, in download
    for mirror in MirrorList():
  File "/Users/certik/ext/sage-6.5/src/bin/sage-download-file", line 155, in __init__
    self._rank_mirrors()
  File "/Users/certik/ext/sage-6.5/src/bin/sage-download-file", line 217, in _rank_mirrors
    printflush('Fastest mirror: ' + self.fastest)
  File "/Users/certik/ext/sage-6.5/src/bin/sage-download-file", line 221, in fastest
    return self.mirrors[0]
IndexError: list index out of range
Error: downloading configure-99.tar.gz failed
make: *** [configure] Error 1
Sudhanshu Mishra
@debugger22
Jun 29 2015 17:23
@certik I pinged you on https://gitter.im/sympy/sympy. Please have a look at our discussion regarding Hermitian/Anti Hermitian assumptions. We need your help to understand the use of it. sympy/sympy#1158 introduced it.
Ondřej Čertík
@certik
Jun 29 2015 17:26
@isuruf how do you install Sage? I'll do it just like you do, I just need to get it working somehow for development. Users will just download the binary and install the required spkg by hand, so it will be easy.
Ondřej Čertík
@certik
Jun 29 2015 17:31
Ok, I'll try it out.
Isuru Fernando
@isuruf
Jun 29 2015 17:31
Your error seems to be about not connecting to mirrors. Are you behind a proxy?
Ondřej Čertík
@certik
Jun 29 2015 17:31
Yes, I am actually behind a proxy.
I thought all the sources are already downloaded in the directory.
Isuru Fernando
@isuruf
Jun 29 2015 17:32
Sources for sage are, but sources of other packages like sympy are downloaded from mirrors
Isuru Fernando
@isuruf
Jun 29 2015 17:38
They do not support downloading through a proxy, not sure though.
Packages are here, http://mirrors.mit.edu/sage/spkg/upstream/
but you have to download them one by one. Let me find another way
Ondřej Čertík
@certik
Jun 29 2015 17:38
I setup http_proxy and https_proxy environment variables correctly, so curl works from the command line. But Sage must be ignoring these, that's why it fails.
(sage-download_package must be patched as well, besides setting the environment variables.)
Isuru Fernando
@isuruf
Jun 29 2015 17:43
Let me know if it works. I can use it in my university then. :D
Isuru Fernando
@isuruf
Jun 29 2015 17:49
Btw, if we are going to have a release would it be 0.1.0 or 0.0.1 ?
Ondřej Čertík
@certik
Jun 29 2015 17:55
I would do 0.1
Isuru Fernando
@isuruf
Jun 29 2015 18:43
@certik, were you able to use the proxy to download
Ondřej Čertík
@certik
Jun 29 2015 19:20
So I need to merge your curl and cmake branches?