Skip to content

GNU Make: Add new option DEBUG_OPT_LEVEL#4674

Merged
asalmgren merged 1 commit intoAMReX-Codes:developmentfrom
WeiqunZhang:debug_opt_level
Sep 25, 2025
Merged

GNU Make: Add new option DEBUG_OPT_LEVEL#4674
asalmgren merged 1 commit intoAMReX-Codes:developmentfrom
WeiqunZhang:debug_opt_level

Conversation

@WeiqunZhang
Copy link
Copy Markdown
Member

This does not change the existing behavior, because it's 0 by default. This allows us to increase the optimization level when DEBUG=TRUE.

ERF's radiation test problem does not compile with USE_CUDA=TRUE DEBUG=TRUE. It fails at link time with

/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x21): relocation truncated to fit: R_X86_64_GOTPCRELX against symbol `__libc_start_main@@GLIBC_2.34' defined in .text section in /lib/x86_64-linux-gnu/libc.so.6
/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o:(.eh_frame+0x20): relocation truncated to fit: R_X86_64_PC32 against `.text'
/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o: in function `_init':
(.init+0xb): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `__gmon_start__'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_a3bf49b59a3e5c73e23c76622c3ce0951724bc73':
cuda_runtime_api.cpp:(.text.startup+0x19): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x20): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x27): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x3d): relocation truncated to fit: R_X86_64_PC32 against `.data'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_7bd86af72cd50dfe63513852abf557d8ffc48b76':
cudart_global.cpp:(.text.startup+0xbb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
cudart_global.cpp:(.text.startup+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `__dso_handle' defined in .data.rel.local section in /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o
cudart_global.cpp:(.text.startup+0xd2): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o):(.eh_frame+0x4b18): additional relocation overflows omitted from the output
ERF3d.gnu.DEBUG.MPI.CUDA.ex: PC-relative offset overflow in PLT entry for `mlock@@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
make: *** [../../../Submodules/AMReX/Tools/GNUMake/Make.rules:64: ERF3d.gnu.DEBUG.MPI.CUDA.ex] Error 1

With USE_CUDA=TRUE DEBUG=TRUE DEBUG_OPT_LEVEL=1, it compiles.

This does not change the existing behavior, because it's 0 by
default. This allows us to increase the optimization level when
DEBUG=TRUE.

ERF's radiation test problem does not compile with
`USE_CUDA=TRUE DEBUG=TRUE`. It fails at link time with
```
/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x21): relocation truncated to fit: R_X86_64_GOTPCRELX against symbol `__libc_start_main@@GLIBC_2.34' defined in .text section in /lib/x86_64-linux-gnu/libc.so.6
/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o:(.eh_frame+0x20): relocation truncated to fit: R_X86_64_PC32 against `.text'
/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o: in function `_init':
(.init+0xb): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `__gmon_start__'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_a3bf49b59a3e5c73e23c76622c3ce0951724bc73':
cuda_runtime_api.cpp:(.text.startup+0x19): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x20): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x27): relocation truncated to fit: R_X86_64_PC32 against `.data'
cuda_runtime_api.cpp:(.text.startup+0x3d): relocation truncated to fit: R_X86_64_PC32 against `.data'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_7bd86af72cd50dfe63513852abf557d8ffc48b76':
cudart_global.cpp:(.text.startup+0xbb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
cudart_global.cpp:(.text.startup+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `__dso_handle' defined in .data.rel.local section in /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o
cudart_global.cpp:(.text.startup+0xd2): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o):(.eh_frame+0x4b18): additional relocation overflows omitted from the output
ERF3d.gnu.DEBUG.MPI.CUDA.ex: PC-relative offset overflow in PLT entry for `mlock@@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
make: *** [../../../Submodules/AMReX/Tools/GNUMake/Make.rules:64: ERF3d.gnu.DEBUG.MPI.CUDA.ex] Error 1
```

With `USE_CUDA=TRUE DEBUG=TRUE DEBUG_OPT_LEVEL=1`, it compiles.
@asalmgren asalmgren enabled auto-merge (squash) September 25, 2025 02:51
@asalmgren asalmgren merged commit df20009 into AMReX-Codes:development Sep 25, 2025
74 of 75 checks passed
@WeiqunZhang WeiqunZhang deleted the debug_opt_level branch September 25, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants