Version 17 (modified by hfinkel, 6 years ago) (diff)


Welcome to using LLVM/clang on the BG/Q

ANL Early Access

If you have access to ANL's early access development systems, please also see (for usage details): LLVM on the BG/Q Early-Access Wiki

For the benefit of those without access, here is a copy of our bgclang wrapper script (as of 2012-06-02). For use on other systems, you'll need to change some of the paths, but this will let you see what optimization settings are used by default. You should symlink this to bgclang++ to create a C++ wrapper.

Similarly, llvm_bgq_mpi-20120604.tar.gz contains the MPI wrapper scripts (modified from the corresponding gcc wrapper scripts), and patched MPI headers. bgclang can use the system MPI headers as provided, but the patched versions include type safety attributes used to type check MPI calls (thus taking advantage of a great new feature being developed by Dmitri Gribenko).

Repository Information

I have yet to figure out how to best mirror my local repositories. Here's why:

  • LLVM uses subversion, and I've been using git-svn to manage local BG/Q changes.
  • git-svn uses rebasing to apply local changes on top of upstream changes; this amounts to history rewriting (dangerous but effective). I cannot simply push from the git-svn-managed repository to the public one because doing so would confuse copies cloned from the public version.
  • LLVM uses separate repositories for LLVM and clang, it is not clear how to best combine them into one public repository.

Thus, for the time being, we'll just need to use patches. Maybe I should push into separate (new) branches every time I commit? I'm certainly open to suggestions.



Significant improvements include:

  • Support for type-safety attributes (clang feature developed by Dmitri Gribenko for type checking calls to MPI functions).
  • LLVM now generates pre-increment load/store instructions (only r+imm form supported so far, r+r form, necessary for QPX pre-increment, is still under development).


Note: the date tag on the clang patch regressed compared to the previous version because upstream commits rendered later local changes irrelevant.



Follow the normal directions for checking out llvm and clang from the repositories. Run configure. I recommend building from a directory different from the source directory. I use the following make command:

 make -j 8 ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 EXTRA_OPTIONS=-mminimal-toc prefix=/home/projects/llvm install
 cp -Rf ${LLVM_SRC_DIR}/tools/clang/tools/scan-{build,view} /home/projects/llvm/

Where the command is run from the top-level build directory and LLVM_SRC_DIR is set to the path to the top-level source directory.