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

Compiling in parallel #57

Closed
michalmuskala opened this issue Jun 1, 2016 · 5 comments · Fixed by #75
Closed

Compiling in parallel #57

michalmuskala opened this issue Jun 1, 2016 · 5 comments · Fixed by #75

Comments

@michalmuskala
Copy link

Many of the plugins compile some files through make, that's why I'm opening the issue here, in the parent repository.

Should asdf detect if it can compile in parallel and set proper -jn flags for make? Is this a job for asdf, or should it assume user has proper MAKEFLAGS env variable set?
This can potentially significantly speed up compilation.

@HashNuke
Copy link
Member

HashNuke commented Jun 1, 2016

@michalmuskala If parallel is good, then let us make the asdf plugins use the parallel flag by default atleast for languages that are known to work well with it.

@michalmuskala
Copy link
Author

I see that each plug-in has entirely separate code from the core manager, so each one would need to solve this on it's own.

The really tricky part is deciding on the number of concurrent jobs. A good rule is the number of cores, but the issue is there's no easy cross-platform way of determining it.
In order of how easy to use they are:

  • On modern linux there should be nproc command
  • On OSX you can use sysctl -n hw.ncpu
  • On older linux (or some stripped down versions) you can go through /proc/cpuinfo: grep -c processor /proc/cpuinfo
  • On Windows gnu make does not support concurrent jobs, so it doesn't matter.

@danhper
Copy link
Member

danhper commented Jun 12, 2016

I think we could set ASDF_CONCURRENCY before delegating the build to the plugin,
so that plugin writers do not have to do this check on their own.

On Windows gnu make does not support concurrent jobs, so it doesn't matter.

Does that means that make -j2 would break, or simply be noop?

@michalmuskala
Copy link
Author

The GNU make documents it as being a noop on windows:

https://www.gnu.org/software/make/manual/html_node/Parallel.html

On MS-DOS, the ‘-j’ option has no effect, since that system doesn’t support multi-processing.

It talks about MS-DOS, so I'm not sure it applies to modern windowses as well.

It could probably detect it on a best effort basis and set to 1 otherwise. It will still be better than the current situation.

@danhper
Copy link
Member

danhper commented Jun 16, 2016

@michalmuskala

On MS-DOS, the ‘-j’ option has no effect, since that system doesn’t support multi-processing.
It talks about MS-DOS, so I'm not sure it applies to modern windowses as well.

Thanks.
I will try to check in a VM or something, but at least it should probably not emit any error.

It could probably detect it on a best effort basis and set to 1 otherwise. It will still be better than the current situation.

I agree. I will try to add this feature during the week.

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 a pull request may close this issue.

3 participants