PRUNERS / archer

Archer, a data race detection tool for large OpenMP applications
https://pruners.github.io/archer
Apache License 2.0
62 stars 13 forks source link

Build issue on macOS X #7

Closed SumedhArani closed 6 years ago

SumedhArani commented 7 years ago

In the case of building archer along with clang/llvm as per readme.md, cloning OMPT creates a LLVM-openmp folder rather than a openmp folder.

git clone git@github.com:OpenMPToolsInterface/LLVM-openmp.git

So, suitable corrections must me made.

And there was one more issue that I was facing which kept saying that the OMPT_INCLUDE_PATH variable was set to not found. I saw the contents of the LLVM-openmp folder (OpenMP with OMPT support) and no ompt.h file was being generated in the build folders. I feel there are two corrections to be made in archer/cmake/FindOmpt.cmake

FIND_PATH(OMPT_INCLUDE_PATH ompt.h

The ompt.h should be changed to omp.h as that is the file being generated in the build folders.

PATHS ${LLVM_ROOT}/include ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src

openmp should be changed to LLVM-openmp. This can be avoided if the there are corrections made to the first point itself.

Is development tested on macOS X?

dongahn commented 7 years ago

Nice detective work! Perhaps you can submit a PR with these changes?

This will at lease allow us to check whether this will break our CI tests and also allow us to review your changes with diff lines.

Dong


From: Sumedh Arani notifications@github.com Sent: Monday, January 30, 2017 3:52:40 PM To: PRUNERS/ARCHER Cc: Subscribed Subject: [PRUNERS/ARCHER] Build issue on macOS X (#7)

In the case of building archer along with clang/llvm as per readme.md, cloning OMPT creates a LLVM-openmp folder rather than a openmp folder.

git clone git@github.com:OpenMPToolsInterface/LLVM-openmp.git

So, suitable corrections must me made.

And there was one more issue that I was facing which kept saying that the OMPT_INCLUDE_PATH variable was set to not found. I saw the contents of the LLVM-openmp folder (OpenMP with OMPT support) and no ompt.h file was being generated in the build folders. I feel there are two corrections to be made in archer/cmake/FindOmpt.cmake

FIND_PATH(OMPT_INCLUDE_PATH ompt.h

The ompt.h should be changed to omp.h as that is the file being generated in the build folders.

PATHS ${LLVM_ROOT}/include ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src

openmp should be changed to LLVM-openmp. This can be avoided if the there are corrections made to the first point itself.

Is development tested on macOS X?

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/PRUNERS/ARCHER/issues/7, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA0nqyAf9tFhy_UKBqAqhU86u3UsnplUks5rXnfIgaJpZM4LyEk4.

SumedhArani commented 7 years ago

Sure! Will follow up on the same.

dongahn commented 7 years ago

Thanks!

On the user interface tools, I think the first step would always be able to parse a race report and load each incident into memory...


From: Sumedh Arani notifications@github.com Sent: Monday, January 30, 2017 4:18:46 PM To: PRUNERS/ARCHER Cc: Ahn, Dong H.; Comment Subject: Re: [PRUNERS/ARCHER] Build issue on macOS X (#7)

Sure! Will follow up on the same.

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/PRUNERS/ARCHER/issues/7#issuecomment-276235051, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA0nq9-Y53NF8elPYG_cp9C8FdRToizUks5rXn3mgaJpZM4LyEk4.

SumedhArani commented 7 years ago

I still find it difficult to get the build of clang-archer working. Initial issues raised when it was returning variable not found for OMPT_INCLUDE_PATH which I changed it to the folder where I built the files of ompt after cloning it from the said repository.

As stated earlier in this thread, there is no ompt.h file being generated. On changing it to omp.h and setting the path to the folder contains this file, the above stated error does not arise and the build files are successfully generated.

When I then run a make command, I get an error saying file not found. I tried renaming the file in the build folder from omp.h to ompt.h, it comes up with a new error

Unknown type name

simoatze commented 7 years ago

Hi @SumedhArani, ARCHER has never been tested on Mac OSX. If you are able to build LLVM 3.9 and the OpenMP with OMPT support (the version stated in the README) I suggest you to build first those and then build ARCHER stand-alone. That would definitely solve the omp.h and ompt.h problem since they will be installed in your "include" folder at the installation path and the cmake will find them when configuring ARCHER.

SumedhArani commented 7 years ago

Hello @simoatze :)

It worked! I did it using stand alone method only. Apparently there was a small typographical error. I've used cmake followed by make. These error were arising error due to cmake paths I presume.

I for now have used the LLVM installed using brew formula and is of version 3.9.1 and have not built it from source.

But there is a necessary change required in renaming the files with regard to OMPT support else the FindOmpt.cmake file not be able to set the path.

Currently, I've set known path name in my cmake file so as to find the ompt.h which I renamed it after building ompt in runtime/src/

And also small corrections are necessary in the readme as well as stated in the previous comment which I'll try to follow it up soon with a PR.

Thank you.

simoatze commented 7 years ago

@SumedhArani awesome! I fixed the README when cloning the LLVM-ompt, it clones into "openmp" now.

Were you able to compile LLVM/Clang and OpenMP with OMPT on Mac without any changes in the cmake? Could you send me or create a Pull Request so I can test it myself and add the changes to have ARCHER working on MacOS as well?

Thanks a lot!

SumedhArani commented 7 years ago

Issues were there regarding building it on macOS X but I've got clang-archer working with a brew installed LLVM version with minor updates in a few files.

I successfully got the desired output .

@dongahn I'll get started ASAP with the assigned task.

On the user interface tools, I think the first step would always be able to parse a race report and load each incident into memory...

Regarding the installation, I'll try updating a few files and put in a PR ASAP as to what I think will be necessary changes as required on an linux system.

I also think that OMPT support is a must else the build have throw up an error as OMPT_INCLUDE_PATH will be set to NOT_FOUND and there will be errors when trying to build ompt-tsan.cpp. So I think that the document should have only building openMP with OMPT support.

Should I document installation on OSX machines? (Standalone)

simoatze commented 7 years ago

The ARCHER cmake checks if the OMPT installation exists, in that case also build the runtime (ompt-tsan.cpp) if there is not support for OMPT it assumes that you have the LLVM OpenMP Runtime with the Tsan Annotations so it won't compile the runtime.

It would be great if you can document the installation on OS X machines!

Thanks @SumedhArani!

SumedhArani commented 7 years ago

Oh I didn't know about that. Thanks @simoatze!

I'll also soon make a pull request with the updated readme.md

simoatze commented 7 years ago

@SumedhArani when you have some time would you put a PR with your edit to make Archer work on Mac OS? Thanks!

SumedhArani commented 7 years ago

Oh yeah! Sure. I totally forgot about that. I'll properly document and edit the readme file during this weekend. Is it good with you @simoatze ?

Thanks!

simoatze commented 7 years ago

@SumedhArani no rush! Focus on your exams and do it whenever you have extra time! Good luck and thanks a lot!

SumedhArani commented 7 years ago

Greetings!

@simoatze There seems to be an error with OMPT. I don't remember what workaround I did last time. I simply tried to reinstall ompt and I'm getting a error error: use of undeclared identifier 'sched_getcpu' On searching, it showed that macOS does not have the sched_getcpu() function and hence the error. Stack overflow did suggest alternative function. My point being that ompt support cannot be given to macOS machines. The make fails but an ompt.h file gets created which gets used by archer and archer compiles successfully but this is a potential pitfall.

Thank you.

simoatze commented 7 years ago

@sumedharani you need OMPT support for archer (it works better with no false positives). Do you have access to a Linux machine?

jprotze commented 7 years ago

@SumedhArani Thanks for the report. I created an issue at the OpenMP-runtime implementation (OpenMPToolsInterface/LLVM-openmp#11). This should fix your issue for now:

git revert 6284dd0c46f7c6eb48a70809a8a6f64e7cc8e7dd

jprotze commented 7 years ago

Actually, would it build on mac, if you add #include <sched.h> in ompt-general.cpp?

SumedhArani commented 7 years ago

macOS Equivalent for sched_getcpu()

According to this answer on stack overflow, I've made the necessary changes to get a temporary workaround as of now and the code compiles. Both return int, so I guess it should not be a error for now but I've not tested for the same.

@simoatze So I do have archer with ompt support as of now. @jprotze When I did apropos sched_getcpu there were no entries found and also on Apple Dev forums, they've mentioned that BSD systems do not have this function and also on reading I found that Windows has an alternative function for the same.

Thank you.

SumedhArani commented 7 years ago

@jprotze @simoatze There seems to be an typo you've made while writing the .in files for clang-archer in archer/tools/

You've specified that the static library file path as archer/build/lib/ which actually should have been archer/build/rtl instead on line 59 & 61 in /tools/clang-archer.in

Also for macOS machines, we need to change the archer/build/lib/LLVMArcher.so in tools/clang-archer to archer/build/lib/LLVMArcher.dylib

Even after all these corrections, I keep facing errors like

  1. unknown options -larcher
  2. directory not found for that OMP_PREFIX/lib because on checking the hierarchy, there seems to be no lib folder but I found that an another folder had the lib folder. So as of now, this error is worked out.
  3. unknown options -rpath

Could someone please help me out with the same.

Thank you.

simoatze commented 7 years ago

@SumedhArani the patht to the static and shared libraries is in general @CMAKE_INSTALL_PREFIX@ which is the path where archer will be installed and that you specify at cmake config time with -D CMAKE_INSTALL_PREFIX:PATH=/install/path. The path can't be archer/build because that's your local build. How do you configure archer? Make sure you pulled the last changes under the towards_tr4 branch.

jprotze commented 7 years ago

I'm currently setting up Travis to test the ompt runtime for clang/gcc on Linux and for clang-omp on osx. With that build problems for OpenMP​/towards_tr4 shouldn't happen anymore.

I think with cmake you can use some target generator expressions to specify the created library name. With that, cmake will take care of the file ending .so vs. .dylib

dongahn commented 7 years ago

Does Travis support os/x?

jprotze commented 7 years ago

https://travis-ci.org/PRUNERS/archer already tests for os/x

simoatze commented 7 years ago

That's just @SumedhArani PR, I will test it on my mac as soon as I have time.

SumedhArani commented 7 years ago

@jprotze

I'm currently setting up Travis to test the ompt runtime for clang/gcc on Linux and for clang-omp on osx.

clang-omp is obsolete as of date and instead openmp is shipped along with brew installed LLVM

They no more clang-omp. This is what I came across while trying to get the setup on my macOS.

jprotze commented 7 years ago

@dongahn yes, travis supports os/x. we use this to test PnMPI: https://github.com/RWTH-HPC/PnMPI/blob/master/.travis.yml

@simoatze I think, you don't need sudo? As far as I understood, you can just set sudo:false and travis will use container builts

simoatze commented 7 years ago

@jprotze I think you are right, I just wanted to test in my mac and add some #ifdef MACOS or so if needed.