Search code examples
gccparallel-processingopenmpgnulibgomp

How to use a local version of openMP? (GOMP)


I'd like to bring up some changes (just some prints momentarily) to the GOMP library that I've downloaded from the git repo but seems like what I'm doing is not really effective because there's no print when execute my code.

What I've tried to do after downloading GCC and build it in a build/ folder is calling make -j'nproc' and then make install from here I tried to use my version of GCC by gcc/build/install/gcc -o test - test.c end it worked, so I started to modify the LIBGOM target.c file and put some print in a function I'm quite sure is called (checked by callgrind) "GOMP_target_ext" so I called again those 2 make commands and compile again but my changes didn't have any impact on it. so I tried to call gcc/build/install/bin/gcc -o test -fopenmp test.c and this didn't change much too. I thought could be the way I call OpenMP in my code so I've changed #include "omp.h" to #include <omp.h> but nothing again. what am I missing?


Solution

  • On Unix/Linux you can use the LD_PRELOAD environment variable to force loading your library other libraries are loaded by ld. With weak linking you can even override symbols from a library that is loaded later (e.g. your own malloc).