-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile code to be relocatable. #261
Comments
Do you need this through spack-stack? If you just need it for your own development copy of ip, then building with |
The goal is to make python call libwgrib2.so (import pywgrib2_s). This
means that libraries
that wgrib2 calls will have to be compiled with -fPIC.
…On Fri, Nov 29, 2024 at 6:07 PM Alex Richert ***@***.***> wrote:
Do you need this through spack-stack? If you just need it for your own
development copy of ip, then building with
-DCMAKE_POSITION_INDEPENDENT_CODE=ON should do the trick (I assume you're
compiling a static library).
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZV2W4JUEMQLILZM7MT2DDXR5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBYG4ZDINRSGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Have you already tried |
I got all the netcdf, hdf5, g2c, png, jasper, openjpeg, aec libraries to
work.
IP was the only exception. I can make wgrib2 when I turned off
MAKE_SHARED_LIB
in wgrib2.
…On Mon, Dec 2, 2024 at 1:59 PM Alex Richert ***@***.***> wrote:
Have you already tried -DCMAKE_POSITION_INDEPENDENT_CODE=ON for wgrib2?
If that doesn't work then that's probably a cmake bug for wgrib2.
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZX4SS4FRHSDGGJ7EPL2DSUYBAVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGQ3DIMJUG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
To investigate further I'll need exact steps to reproduce the problem, please. |
How I tell whether *.a is relocatable:
$ ar x libip_4.a
$ gcc -shared -o libtest.so *.o
Complaints about -fPIC.
I built ip by:
git clone "https://github.com/NOAA-EMC/NCEPLIBS-ip"
cd NCEPLIB-ip
edit CMakeLists.txt
change option(OPENMP "Use OpenMP threading" OFF)
to option(OPENMP "Use OpenMP threading" ON)
mkdir build
cd build
make
sudo make install
…On Mon, Dec 2, 2024 at 2:56 PM Alex Richert ***@***.***> wrote:
To investigate further I'll need exact steps to reproduce the problem,
please.
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZUY6JOKWLW6EXOSSN32DS3M5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGY2DENBQGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I don't see the cmake step-- are you using |
No. So I have to make a non-default version of IP.
…On Mon, Dec 2, 2024 at 3:54 PM Alex Richert ***@***.***> wrote:
I don't see the cmake step-- are you using
-DCMAKE_POSITION_INDEPENDENT_CODE=ON? i.e., cmake ..
-DCMAKE_POSITION_INDEPENDENT_CODE=ON?
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZQFLYY6ITPJBK4P6ML2DTCJ5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSHAYDQNJRGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Correct, it'll require either explicit PIC with the above build option, or building the shared version. |
Of course it works if you rebuild the IP package
with -DCMAKE_POSITION_INDEPENDENT_CODE=ON.
The point is that the default cmake options does not produce a library that
is usable in some
applications. One could argue that the position independent code is a
unusual feature and
is not worth the performance penalty. Anyways I need to know the IPlib
policy for future wgrib2
documentation.
…On Mon, Dec 2, 2024 at 5:08 PM Alex Richert ***@***.***> wrote:
Correct, it'll require either explicit PIC with the above build option, or
building the shared version.
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZXYYBJSZBDQWCRLBZD2DTK35AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJTGA2DENZZGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I'd be open to changing the default if it doesn't have a significant impact on performance. In the case of, say, g2c, I would have expected that it would have the same issue. Which version of ip are you using, is this the head of develop? |
Performance is important but people tend not to worry about ip and g2/g2c
because
those are used in I/O bound processes (at least for the models). The time
sensitive
NCEP uses of wgrib2 are NOMADS and the gfs post-processing. The NOMADS job
doesn't
use IP. The post-processing uses IP but tends to be I/O bound.
G2c is position independent, and I am using the develop version of IP.
Openblas,
PNG, AEC libraries from Ubuntu were position independent. The Jasper build
was by default position independent.
…On Tue, Dec 3, 2024 at 5:11 PM Alex Richert ***@***.***> wrote:
I'd be open to changing the default if it doesn't have a significant
impact on performance. In the case of, say, g2c, I would have expected that
it would have the same issue. Which version of ip are you using, is this
the head of develop?
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEIB7ZWWNVKBEHZ35Z67XAT2DYUCRAVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJVGY2TKMRVGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Compile with -fPIC to get relocatable code. Want to make a (relocatable) python library that uses iplib.
The text was updated successfully, but these errors were encountered: