admb-project / admb

AD Model Builder
http://admb-project.org
Other
64 stars 19 forks source link

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

Closed yukio-takeuchi closed 4 years ago

yukio-takeuchi commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Hi,

I re-run make -j4 test on Ubuntu 18.04 PC with 4 cores and make -j2 test on Ubuntu 18.04 PC with 2 cores. Both finished make -jn test without any problems.

Many thanks.

BTW as you mentioned, -j8 would be asking too many parallelizations. Ususually I set same numer as number of physical cores (I only have 2 or 4 core PC). -j8 is used in order to increase the chance to mee error I described for testing.

2020/02/28 7:22、johnoel notifications@github.comのメール:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/admb-project/admb/issues/126?email_source=notifications&email_token=AAZ3FVUY5I4BNQNSSALHZOLRFA4KZA5CNFSM4K42UNC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENGGCPI#issuecomment-592208189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ3FVVKDYIGSQQK5V2L2ITRFA4KZANCNFSM4K42UNCQ.