Skip to content
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

Way to specify target architecture for compile_package? #118

Closed
JackDunnNZ opened this issue Sep 17, 2018 · 6 comments
Closed

Way to specify target architecture for compile_package? #118

JackDunnNZ opened this issue Sep 17, 2018 · 6 comments

Comments

@JackDunnNZ
Copy link
Contributor

I would like to generate a compiled sysimg for a wider target architecture than the default choice. Currently I have modified compile_package here to pass the desired cpu_target, but it would be good to have this supported in the main package.

I would file a PR but I am not sure which flags you would think to expose or the best way to organize it.

@NHDaly
Copy link
Member

NHDaly commented Sep 17, 2018

There's already a flag for it! :)

I think on juliac it's -C, and in the Julia function, static_julia, it's cpu_target.

I'm on vacation now but I'll check in a bit. For example, though, when compiling on a Mac, I use -C x86-64 to target all Macs.

@JackDunnNZ
Copy link
Contributor Author

Thanks for the response, no rush at all!

The problem I'm having is simply that the cpu_target is not used in the call to build_sysimg inside the compile_package function (which is my entry point to the package). build_sysimg is just a wrapper around static_julia and even has the cpu_target arg, but it's just not used at the call site.

For clarity, my workflow is simply

using PackageCompiler
compile_package("xxx")

and it would be great to be able to have

using PackageCompiler
compile_package("xxx", cpu_target="x86-64")

@NHDaly
Copy link
Member

NHDaly commented Sep 18, 2018

Ah yes makes sense! I think that sounds great, I'd say just sending a PR to add that option makes sense!

Just curious, can you elaborate on your use-case? Why are you hoping to build a sysimg for a larger target? Is this for a sysadmin type situation where you want to share your precompiled sysimg with people?

Because you should know, we're still experimenting to figure out how this all works best (here and here at least), but I think that if you start julia using a sysimg built for a more generic target, it's by default going to recompile everything for native anyway!

So if you do build a sysimg for a non-native cpu target, when you use it, you should start julia with either --compile=min or --compile=no. :) That could be part of why Simon didn't add the option to specify a cpu_target on compile_package: it's currently intended as basically a way to speed-up julia on your own machine.

So hearing more about your intended use would help figure out how to change the api! :)

@SimonDanisch
Copy link
Collaborator

Yeah I guess I was imagining compile_package("xxx") as something you would use locally. We haven't really figured out an API to ship compiled images, so it hasn't really been part of the prime use cases ;)

@JackDunnNZ
Copy link
Contributor Author

Thanks that's really helpful. Yeah, right now we are just using it as a mechanism for building and shipping a batteries-included sysimg (with some unregistered and/or private packages) just so that we can get people up and running as fast as possible without having to worry about getting them access to repos etc- the compilation speed up is not really on the radar but would be a nice-to-have!

I'll file the PR, but I don't want to get in the way of your design - I think we are a pretty edge case and I am happy to work around things. I think the "proper" end game would be for us to move to a compiled library instead (where things like #26 look really cool), but right now it's good just to have something easy (albeit hacky) that works!

@SimonDanisch
Copy link
Collaborator

I don't think exposing the cpu target flag will be any problem to our design ;) It's just I didn't expect it..

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

No branches or pull requests

3 participants