Skip to content

WIP: pyjulia updates - #54

Merged
Keno merged 13 commits into
masterfrom
kf/inprocsyms
Jul 18, 2016
Merged

Keno merged 13 commits into
masterfrom
kf/inprocsyms

Conversation

@Keno

@Keno Keno commented Jul 7, 2016 •

Copy link
Copy Markdown
Contributor

This does two things:

  1. A rebase of some of the previous pull requests to bring pyjulia up to date with more modern versions of julia
  2. Attempt to solve the challenges encountered with PyCall (i.e. Custom builds of PyCall.jl #51)

The approach taken to 2) is to

a. Separate out cache files into a separate directory to reflect the fact that this is a quite different environment. It may be theoretically possible to share packages that do not depend on PyCall, but this could turn out to be quite brittle and the necessary logic does not currently exist in julia to handle this situation. I think a clean separation as is done here is the best way to go.
b. Use a python script that calls the argument parsing routines directly. This is necessary because the precompilation and runtime environment needs to be the same in order for PyCall to be able to be used without major modification (small PyCall PR to enable loading in-process symbols is forthcoming). I played with a couple of variants here, but I think I've arrived at a very simple/effective solution.

Remaining todo:

  • Only enable this if python is statically linked?
  • COFF Wrapper for windows
  • Test on other Unix platforms
  • Mac CI
  • Enable AppVeyor
  • Make sure new code path is actually tested
  • Windows cross-version test on CI
  • Update COFF wrappers to 32bit
  • Include lib/julia in libjulia RPATH JuliaLang/julia#17458 to fix tests

Comment thread julia/core.py Outdated

if init_julia:
# Replace the cache directory with a private one. PyCall needs a different
# configuration and so do any packages that depend on it. Ideally, we could

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we use the normal pycall?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a different configuration (in-process vs shared library).

Comment thread julia/core.py Outdated
# but that would be significantly more complicated and brittle, and may not
# be worth it.
self._call(u"empty!(Base.LOAD_CACHE_PATH)")
self._call(u"push!(Base.LOAD_CACHE_PATH, abspath(Pkg.Dir._pkgroot()," +

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using internal methods here doesn't look like a great idea for stability's sake

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean _pkgroot? Unfortunately that's how to determine where this directory is. If you want to advocate for exporting that method from Base, be my guest.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or use the existing LOAD_CACHE_PATH and just modify that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an ok option/

@Keno
Keno force-pushed the kf/inprocsyms branch 5 times, most recently from 9bbbe4c to f3aba3c Compare July 7, 2016 18:57
Comment thread julia/core.py Outdated
if not sys.platform.startswith('linux'):
return False
lddoutput = subprocess.check_output(["ldd",sys.executable])
return not lddoutput.conains("libpython")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes already fixed locally. Give me a few more mins and I'll push all the windows code.

@Keno

Keno commented Jul 9, 2016

Copy link
Copy Markdown
Contributor Author

There's a travis failure here I don't understand: Type str doesn't support the buffer API. Works fine for me locally, even with python 3.

Comment thread appveyor.yml Outdated

branches:
only:
- clean-julia-0.4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably change this to only master, otherwise you get duplicate builds (branch and pr)

@stevengj

Copy link
Copy Markdown
Member

Do we really want julia-debug.exe to be checked into git?

@Keno

Keno commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

Yes, it's not the real julia-debug.exe, it's just a very small COFF wrapper.

@tkelman

tkelman commented Jul 12, 2016

Copy link
Copy Markdown

win32 or win64?

@Keno

Keno commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

win64, though as long as your os is 64bit it doesn't matter. I suppose I could just compile it as 32bit and have it work anywhere.

@tkelman

tkelman commented Jul 12, 2016

Copy link
Copy Markdown

if it's just executed as a command line wrapper, that might work more places. we did have a complaint that 0.4.6 doesn't work in a win32 os, so there are still some users.

@tkelman

tkelman commented Jul 12, 2016

Copy link
Copy Markdown

Your Travis syntax is broken here and is eating up a lot of JuliaLang's queue. Could you enable it on your fork and work things out on a different branch for now?

@tkelman

tkelman commented Jul 12, 2016

Copy link
Copy Markdown

We could also move this package to JuliaInterop.

@Keno

Keno commented Jul 13, 2016

Copy link
Copy Markdown
Contributor Author

Yep, will move to JuliaInterop

@ararslan

Copy link
Copy Markdown
Member

I enabled AppVeyor here so if you have pyjulia under your AppVeyor account, you can modify it to point here. :)

@Keno
Keno force-pushed the kf/inprocsyms branch 2 times, most recently from 748b646 to 451e123 Compare July 16, 2016 20:31
Comment thread .travis.yml Outdated
notifications:
email: false
before_script:
- echo ./ci/install-julia.sh $JULIA_VERSION

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you end up needing to make changes to this script I'd still rather "upstream" them and have just one copy that lives in the website repo, once you get it all working

@Keno

Keno commented Jul 18, 2016

Copy link
Copy Markdown
Contributor Author

Windows test failure is due to it trying to find rint in the executable and of course not finding it since python is not linked against openlibm. I'm not sure why that's happening, but since it seems fixed on 0.5, I'm not going to put too much effort into attempting to figure out why.

Comment thread fake-julia/julia.py

# As an optimization, share precompiled packages with the main cache directory
libjulia.jl_eval_string(b"""
outputji = Base.JLOptions().outputji

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this use a let to avoid always defining this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is after the incremental image has been written, so it'll go away.

Keno and others added 5 commits July 18, 2016 15:45
Create a python script that emulates being julia and simply hands off control.
This is necessary because the precompilation and runtime environment needs to be
the same in order for PyCall to be able to be used without major modification.

Try a different approach

Only use hack if python is statically linked

New version yet again
Commit small COFF stubs that essentially fill the role of the redirect
bash scripts, since there's no shebang support in the windows kernel.
Fix suggested by jakebolewski and is used instead of np.array_equal
to avoid introducing a numpy dependency into the pyjulia test.
They fail because on 0.4 we were looking for libm symbols in the
executable and python does not have them. This works fine on 0.5
probably due to one of the architectural changes to the JIT, so
it's unlikely this will be backported to 0.4.
@Keno

Keno commented Jul 18, 2016

Copy link
Copy Markdown
Contributor Author

Ok, I'm gonna go and merge this. Travis OS X is complaining, but that's an ecosystem wide problem right now, so oh well. If it turns out to be broken after, I'll fix that separately.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants