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

OpenBLAS uses too many make processes while building #828

Closed
eschnett opened this issue Mar 31, 2016 · 6 comments
Closed

OpenBLAS uses too many make processes while building #828

eschnett opened this issue Mar 31, 2016 · 6 comments

Comments

@eschnett
Copy link
Contributor

While installing Julia 0.4.5 on Stampede at TACC, I received this message from the system administrators:

You are still running too many tasks in the make, please 
STOP performing so many compile tasks at one time, you
are causing excessive load on the logins.  Thanks, TACC Admins
eschnett 18646 18633  0 12:07 pts/366  00:00:00 make -j4
eschnett 33142  9819  1 12:16 pts/366  00:00:00 make -j 16 GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=NEHALEM kernel

It seems the problem occurred while Julia was building OpenBLAS. It also seems that OpenBLAS builds with 16 processes (the number of cores on the login node), although I told Julia to use at most 4 processes (see the first make line quoted above).

Using many processes is fine when building on a laptop or private workstation, but on shared resources, one needs to be less possessive.

It seems that these lines in OpenBLAS's getarch.c are responsible for this:

#if NO_PARALLEL_MAKE==1
    printf("MAKE += -j 1\n");
#else
#ifndef OS_WINDOWS
    printf("MAKE += -j %d\n", get_num_cores());
#endif

Is there a chance that OpenBLAS could not add a -j option if MFLAGS already contains one?

@martin-frbg
Copy link
Collaborator

Which version of OpenBLAS are you building ? Checking the commit history of getarch.c one finds that
a parameter MAKE_NB_JOBS was added to Makefile.rule (and getarch.c of course) on 28 Dec 2015 (which would mean after 0.2.15, but latest is 0.2.17 already)

@eschnett
Copy link
Contributor Author

This is apparently OpenBLAS 0.2.15. (I thought before that it was the tip of the development branch.) I'll check 0.2.17.

@eschnett
Copy link
Contributor Author

0.2.17 still doesn't quite do the right thing. It is possible to manually choose the number of processes, but what I'm looking for is honouring the user's -j option.

This patch does the trick for me:

diff --git a/Makefile.system b/Makefile.system
index b89f60e..2dbdad0 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -139,6 +139,10 @@ NO_PARALLEL_MAKE=0
 endif
 GETARCH_FLAGS  += -DNO_PARALLEL_MAKE=$(NO_PARALLEL_MAKE)

+ifdef MAKE_NO_J
+GETARCH_FLAGS += -DMAKE_NO_J=$(MAKE_NO_J)
+endif
+
 ifdef MAKE_NB_JOBS
 GETARCH_FLAGS += -DMAKE_NB_JOBS=$(MAKE_NB_JOBS)
 endif
diff --git a/getarch.c b/getarch.c
index f9c49e6..dffad70 100644
--- a/getarch.c
+++ b/getarch.c
@@ -1012,6 +1012,7 @@ int main(int argc, char *argv[]){
 #endif
 #endif

+#ifndef MAKE_NO_J
 #ifdef MAKE_NB_JOBS
     printf("MAKE += -j %d\n", MAKE_NB_JOBS);
 #elif NO_PARALLEL_MAKE==1
@@ -1021,6 +1022,7 @@ int main(int argc, char *argv[]){
     printf("MAKE += -j %d\n", get_num_cores());
 #endif
 #endif
+#endif

     break;

This introduces a new make option MAKE_NO_J, that ensures that no -j N option is added to the make command. This makes make honour what the user specified.

@brada4
Copy link
Contributor

brada4 commented Mar 31, 2016

Would be more practical to ask julia to add something to OPENBLAS_BUILD_OPTS to obey own make job count...
Stampede web page says it is SANDYBRIDGE but you build for NEHALEM and dont use AVX

@eschnett
Copy link
Contributor Author

I want to call make without any -j options, because this way, make will communicate with all other make commands currently running to build Julia, and will globally ensure that at most 4 processes are running at one time. If I build OpenBLAS explicitly with make -j4, then there will be 4 make processes for OpenBLAS, plus up to three for other parts of Julia.

I'd like to be able to do that, but if OpenBLAS unconditionally adds a -j option I can't.

I'm not choosing any particular build options for OpenBLAS. I expect this to build a generic version that supports a large number of Intel CPU architectures.

jeromerobert added a commit to jeromerobert/OpenBLAS that referenced this issue Mar 31, 2016
jeromerobert added a commit to jeromerobert/OpenBLAS that referenced this issue Mar 31, 2016
@xianyi
Copy link
Collaborator

xianyi commented Apr 1, 2016

@eschnett ,

@jeromerobert submitted the patch about make MAKE_NB_JOBS=0 to delete -j in OpenBLAS.

vbraun pushed a commit to vbraun/sage that referenced this issue Nov 11, 2023
…cit `make -j N`; but use `make -j 1` on `ubuntu-trusty`

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
OpenMathLib/OpenBLAS#828

<!-- Why is this change required? What problem does it solve? -->
Fixes part of
sagemath#34899 (comment)

Tests at https://github.com/mkoeppe/sage/actions/runs/6779033300:
openblas finishes successfully in https://github.com/mkoeppe/sage/action
s/runs/6779033300/job/18425453802#step:11:3863
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

URL: sagemath#36671
Reported by: Matthias Köppe
Reviewer(s): John H. Palmieri, Matthias Köppe
vbraun pushed a commit to vbraun/sage that referenced this issue Nov 12, 2023
…cit `make -j N`; but use `make -j 1` on `ubuntu-trusty`

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
OpenMathLib/OpenBLAS#828

<!-- Why is this change required? What problem does it solve? -->
Fixes part of
sagemath#34899 (comment)

Tests at https://github.com/mkoeppe/sage/actions/runs/6779033300:
openblas finishes successfully in https://github.com/mkoeppe/sage/action
s/runs/6779033300/job/18425453802#step:11:3863
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36671
Reported by: Matthias Köppe
Reviewer(s): John H. Palmieri, Matthias Köppe
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

4 participants