Use of `-pthread` in `example/prog-guide/Makefile` breaks PGI

Issue #271 resolved
Paul Hargrove created an issue

The Makefile for the Progreammer's Guide examples currently assumes -pthread is an acceptable compiler option. However, this is NOT true of PGI's compilers.

While the Makefile does honor a PTHREAD_FLAGS, there is no documentation which references it.

I believe there are at least three ways to address this, which I list in what I believe is best-to-worst order:

  • Dan has suggested that UPCXX_THREADMODE=par is "necessary and sufficient" to ensure proper compile and link flags are used by upcxx. If that is correct, then we should not be passing any explicit -pthread options (doing so being a "bad example"). So, the best solution may be to remove all instances of $(PTHREAD_FLAGS).
  • If such a flag is needed, then use of (untested) ifeq ($(shell $UPCXX_INSTALL/bin/upcxx --version 2>&1 | grep -w PGI ),) should be sufficient to provide distinct default values of PTHREAD_FLAGS for non-PGI vs PGI compilers. Though a bit messy, this would provide for works-by-default behavior.
  • Add documentation of PTHREAD_FLAGS to the example/prog-guide/README.md

Comments (2)

  1. Log in to comment