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

make test can fail to build if make run in parallel by -j<n> option #126

Closed
yukio-takeuchi opened this issue Feb 27, 2020 · 2 comments
Closed
Milestone

Comments

@yukio-takeuchi
Copy link

On Ubuntu 18.04 with 4 core and 8 threads CPU
make test finished without error. However make -j8 test occasionally failed to build and run tests. In general, error occured where "all" recipe in GNUmakefile is like

all: clean $(TARGET) run

clean:
   rm ..
  ...
  rm ..

$(TARGET): $(TARGET).tpl $(TARGET).dat

run:
  ./$(TARGET)

This probably implicitly assumed that recipes : 'clean', '$(TARGET)' run will be executed sequentially. However if -j8 (or whichever positive integer larger than 1 after -j) is given,
since there is no dependency between $(TARGET) and run, make occasionally try running 'run' recipe before $(TARGET) recipe finish. To resolve this (but it is not clear if it is perfect solution), run needs to have dependency to $(TARGET) i.e.,

run: $(TARGET)

This will tell make to finish $(TARGET) before 'run' starts.
Similar problems are found in at least
tests/gtests/GNUmakefile
tests/test-rules.mak

There can be a similar problem between clean and run. The difficulty is that these error does ot always reproduced. It can happen depending on other processes running on the same PC

johnoel added a commit that referenced this issue Feb 27, 2020
…et dependancies so that -j option works better.
johnoel added a commit that referenced this issue Feb 27, 2020
@johnoel
Copy link
Contributor

johnoel commented Feb 27, 2020

Okay, changed the build files to work better with -j 8. Usually, make -j 4 works without error. Let me know, if the changes build without error.

@yukio-takeuchi
Copy link
Author

yukio-takeuchi commented Feb 27, 2020 via email

@johnoel johnoel added this to the ADMB-12.2 milestone Mar 13, 2021
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

2 participants