New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface Arb with CSymPy, Add Zeta Module #265

Merged
merged 23 commits into from Aug 5, 2014

Conversation

Projects
None yet
4 participants
@sushant-hiray
Copy link
Contributor

sushant-hiray commented Jul 29, 2014

ARB depends on (source- http://fredrikj.net/arb/setup.html#dependencies) :

  • MPIR/GMP (we already have GMP so this is taken care of)
  • MPFR
  • FLINT

So in Travis we will have to explicitly install the other 2 libraries before installing ARB

TODO list:

  • Interface ARB
    • In build directory
    • In installed csympy
  • Bernoulli
  • Zeta
  • Dirichlet_eta
.travis.yml Outdated
@@ -22,6 +22,8 @@ env:
- BUILD_TYPE="Debug" WITH_BFD="yes" WITH_CSYMPY_ASSERT="yes" WITH_PRIMESIEVE="yes"
# Debug build (with BFD and CSYMPY_ASSERT) with Python 2.7
- BUILD_TYPE="Debug" WITH_BFD="yes" WITH_CSYMPY_ASSERT="yes" WITH_PYTHON="yes"
# Debug build (with BFD and CSYMPY_ASSERT) with Python 2.7

This comment has been minimized.

@certik

certik Jul 29, 2014

Contributor

Python 2.7 -> Arb

This comment has been minimized.

@sushant-hiray

sushant-hiray Jul 29, 2014

Author Contributor

Oops. I will sqaush a commit with the fix.

Modified Travis to install ARB if WITH_ARB is set
Also updated bin/test_travis.sh
Fix comment message
.travis.yml Outdated
- if [[ "${WITH_ARB}" == "yes" ]]; then
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.gz;
tar -xzvf mpfr-3.1.2.tar.gz;
cd mpfr-3.1.2 && ./configure && make && sudo make install && cd ..;

This comment has been minimized.

@certik

certik Jul 29, 2014

Contributor

You can install mpfr in Ubuntu using apt-get install libmpfr-dev, that will be much faster.

This comment has been minimized.

@sushant-hiray

sushant-hiray Jul 29, 2014

Author Contributor

Aah, they hadn't specified it on their website explicitly. I will update it.

Update mpfr install command in .travis.yml
The updated command is: sudo apt-get install libmpfr-dev
@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Jul 30, 2014

So the build is failing for the reason that, we install gmp via apt-get install libgmp-dev so as a result the gmp.so is present in /usr/lib whereas arb searches it in /usr/local/lib Hence it is not able to find it.

@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Jul 30, 2014

@certik I was suspecting that gmp.so would be in /usr/lib/ however as it turns out in my case, it is present in /usr/lib/i386-linux-gnu/
Is this the case with you too?
This is why I guess on running ./configure --with-gmp=/usr doesn't work too.

.travis.yml Outdated
- if [[ "${WITH_ARB}" == "yes" ]]; then
sudo apt-get install libmpfr-dev;
wget http://www.flintlib.org/flint-2.4.4.tar.gz;
tar -xzvf flint-2.4.4.tar.gz;

This comment has been minimized.

@certik

certik Jul 30, 2014

Contributor

remove the -v, it's just polluting the output.

.travis.yml Outdated
tar -xzvf flint-2.4.4.tar.gz;
cd flint-2.4.4 && ./configure && make && sudo make install && cd ..;
wget https://github.com/fredrik-johansson/arb/archive/2.1.0.tar.gz;
tar -xzvf 2.1.0.tar.gz;

This comment has been minimized.

@certik

certik Jul 30, 2014

Contributor

Remove the -v.

@certik

This comment has been minimized.

Copy link
Contributor

certik commented Jul 30, 2014

According to this: https://packages.debian.org/unstable/amd64/libgmp-dev/filelist, it is probably in /usr/lib/x86_64-linux-gnu/, but that should be a default search path on Ubuntu/Debian.

@certik

This comment has been minimized.

Copy link
Contributor

certik commented Jul 30, 2014

Yeah, I don't think there is a solution without patching Arb sources. @fredrik-johansson, can you help us here? As you know, I have already reported a related issue fredrik-johansson/arb#3, which prevents us to pass in LDFLAGS. That means however, that we can't specify where the libgmp lives, as in Debian and Travis, it doesn't live in $GMP_ROOT/lib, but rather in $GMP_ROOT/lib/x86_64-linux-gnu/, where $GMP_ROOT=/usr, as we installed it using apt-get.

@fredrik-johansson

This comment has been minimized.

Copy link

fredrik-johansson commented Jul 30, 2014

Did you get flint to work? If so, you should just be able to build flint with arb as an extension package (instead of building arb as a separate library) and everything should be fine.

@certik

This comment has been minimized.

Copy link
Contributor

certik commented Jul 30, 2014

Arb is a separate library with separate releases, so it needs to build on its own. I know it does, but I guess it doesn't if you install gmp and mpfr using Debian/Ubuntu... This is a serious obstacle for users, they need to be able to install Arb easily.

In the meantime (until Arb's build system is improved), any way that we can get it to install on Travis is the way to go (as part of Flint in this PR or separate in sushant-hiray#3), so that we can continue our work.

@certik certik referenced this pull request Jul 30, 2014

Merged

Arb fix #3

Arb: give the GMP paths to "make install"
Thanks to Isuru Fernando (@isuruf) for spotting this.
@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Jul 30, 2014

The builds fail prematurely in this case. The same command works fine on my laptop but seems to have issues on Travis.
https://travis-ci.org/sushant-hiray/csympy/jobs/31245708

/home/travis/build/sushant-hiray/csympy/flint-2.4.4/build/acb_calc/cauchy_bound.lo

cauchy_bound.c:26:22: fatal error: acb_calc.h: No such file or directory

compilation terminated.

sushant-hiray added some commits Jul 30, 2014

Merge branch 'arb-fix' into arb
Conflicts:
	.travis.yml
Adding include flags for arb in CMAKE
This is perhaps not the best way, but works for me
@certik will review this once he is back from
vacation
Added `bernoulli` function
* Linked fmpq_t and  mpq_class
* Added tests.
@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Aug 1, 2014

The builds currently fail because of a particular issue in interfacing arb with c++. A minor patch fixes it, I've asked to include the patch in the 2.1.0 release of arb. Let us see how it goes.

sushant-hiray added some commits Aug 1, 2014

Upgraded ARB from 2.1.0 to 2.2.0
This should fix issues in travis builds
@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Aug 1, 2014

@certik I've updated the CMAKE build system and now tests on travis pass in build directory however the tests don't pass for the installed version.
The build job is here
The command being used is
g++ -std=c++0x -I/home/travis/build/sushant-hiray/csympy/our_usr/include/ -L/home/travis/build/sushant-hiray/csympy/our_usr/lib test_basic.cpp -lcsympy -lgmpxx -lgmp -lteuchos -lbfd -larb -lflint

It raises the following error:
error while loading shared libraries: libarb.so: cannot open shared object file: No such file or directory

Should I add an include path to /usr/local/include so that it can find libarb.so

Added `Zeta` class
* Added the basic API
* Added the function definitions

@sushant-hiray sushant-hiray changed the title [WIP] Interfacing Arb with CSymPy [WIP] Interfacing Arb with CSymPy, Add Zeta Module Aug 2, 2014

@sushant-hiray sushant-hiray changed the title [WIP] Interfacing Arb with CSymPy, Add Zeta Module [WIP] Interface Arb with CSymPy, Add Zeta Module Aug 2, 2014

@isuruf

This comment has been minimized.

Copy link

isuruf commented on CMakeLists.txt in 5b08d65 Aug 2, 2014

isuruf@85519ee
Does this work?

This comment has been minimized.

Copy link
Owner Author

sushant-hiray replied Aug 2, 2014

Have you switched on Travis for your repo, do the tests pass?
Or else can you send a PR on this repo. This looks good to me though. Should work

This comment has been minimized.

Copy link

isuruf replied Aug 2, 2014

Travis tests (https://travis-ci.org/isuruf/csympy/jobs/31487854) fail with the error error while loading shared libraries: libarb.so: cannot open shared object file: No such file or directory

This comment has been minimized.

Copy link
Owner Author

sushant-hiray replied Aug 2, 2014

So this is also facing the same issue. It works in the build directory but doesn't work with Installed library.
I guess adding -L/usr/local/lib should fix that issue. But I'm not sure if this is the correct way the installed library should work.
Surprisingly, although the builds tail on Travis, they pass on Shippable.

This comment has been minimized.

Copy link
Owner Author

sushant-hiray replied Aug 2, 2014

@isuruf I tried adding -L/usr/local/lib but it still isn't able to find libarb.so.
Any clues on what the issue might be?
Also can you send the PR with your changes to install the flint. It is a much cleaner way than want I've currently added.

This comment has been minimized.

Copy link

isuruf replied Aug 2, 2014

Arb library doesn't seem to be available at run-time. The solution in step 4 here, http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html works (I tried it in Travis and it works) although I don't know why libarb.so cannot be found while other libraries in the same folder are found

This comment has been minimized.

Copy link
Owner Author

sushant-hiray replied Aug 2, 2014

Yes this seems to be a weird issue. So for now I would just manually update the LD_LIBRARY_PATH and then we can see if @certik knows any better solution.

sushant-hiray and others added some commits Aug 2, 2014

Added tests for zeta, updated test_travis.sh
test_travis.sh now also searches for /usr/local/lib for libarb.so
Merge branch '4' into arb
Conflicts:
	bin/test_travis.sh
@@ -19,7 +19,7 @@ endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-parameter -ggdb")
"${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-parameter -ggdb ")

This comment has been minimized.

@certik

certik Aug 5, 2014

Contributor

I would remove the added white space, unless there is a reason to keep it in.

g++ -std=c++0x -I$our_install_dir/include/ -L$our_install_dir/lib test_basic.cpp -lcsympy -lgmpxx -lgmp -lteuchos $extra_libs
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

This comment has been minimized.

@certik

certik Aug 5, 2014

Contributor

I assume the LD_LIBRARY_PATH is because of Arb? I don't like that in general, I prefer setting RPATHs on the g++ command line. But since tests pass, we can fix this after this PR is in.

This comment has been minimized.

@certik

certik Aug 5, 2014

Contributor

We can try to figure out a simpler solution after this PR is in. In fact, this manual test is a "de facto" documentation how to actually use csympy for your own programs. So we should polish it more, so that it is canonical and nice. But that's unrelated to this PR, so let's worry about that in some other PR.

This comment has been minimized.

@sushant-hiray

sushant-hiray Aug 5, 2014

Author Contributor

Yes LD_LIBRARY_PATH is for Arb.
Sure we can fix this in subsequent PRs.

assert(eq(r1, r2));
#else
CSYMPY_CHECK_THROW(bernoulli(12), std::runtime_error)
#endif

This comment has been minimized.

@certik

certik Aug 5, 2014

Contributor

Very good, I was thinking to do this exact test, you read my mind. :)

This comment has been minimized.

@sushant-hiray

sushant-hiray Aug 5, 2014

Author Contributor

😄

@certik certik changed the title [WIP] Interface Arb with CSymPy, Add Zeta Module Interface Arb with CSymPy, Add Zeta Module Aug 5, 2014

@certik

This comment has been minimized.

Copy link
Contributor

certik commented Aug 5, 2014

Very good, thank you very much for finishing this. Everything looks good to me. After you address that white space comment above, it is +1 to merge from me.

@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Aug 5, 2014

I've fixed the ws error. I'll merge the PR once tests pass.

@sushant-hiray

This comment has been minimized.

Copy link
Contributor Author

sushant-hiray commented Aug 5, 2014

The tests pass

sushant-hiray added a commit that referenced this pull request Aug 5, 2014

Merge pull request #265 from sushant-hiray/arb
Interface Arb with CSymPy, Add Zeta Module

@sushant-hiray sushant-hiray merged commit fcefa91 into symengine:master Aug 5, 2014

2 checks passed

continuous-integration/travis-ci The Travis CI build passed
Details
default All builds succeeded on Shippable
Details

@sushant-hiray sushant-hiray deleted the sushant-hiray:arb branch Aug 5, 2014

@certik

This comment has been minimized.

Copy link
Contributor

certik commented Aug 5, 2014

Thanks!

Sent from my mobile phone.
On Aug 5, 2014 1:12 AM, "Sushant Hiray" notifications@github.com wrote:

Merged #265 #265.


Reply to this email directly or view it on GitHub
#265 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment