Undefined reference to `nvtxstartrange_'

Hi, I ran into the following error that linker not able to find nvtx functions. I included the path to cuda/lib64 and -lnvToolsExt. But still I got the following error. Did I miss something?

root@a382dd80a857:/home/shared/cm1r20.3/src# make
mpif90 constants.o input.o adv.o adv_routines.o anelp.o azimavg.o base.o bc.o cm1.o cm1libs.o comm.o testcase_simple_phys.o diff2.o eddy_recycle.o goddard.o hifrq.o ib_module.o init3d.o init_physics.o init_surface.o init_terrain.o interp_routines.o kessler.o lfoice.o lsnudge.o maxmin.o misclibs.o morrison.o module_mp_jensen_ishmael.o module_mp_nssl_2mom.o module_mp_p3.o mp_driver.o param.o parcel.o pdef.o pdcomp.o poiss.o sfcphys.o singleton.o radiation_driver.o solve1.o solve2.o solve3.o sounde.o sound.o soundns.o soundcb.o statpack.o stopcm1.o thompson.o module_mp_radar.o turb.o turbtend.o turbnba.o domaindiag.o writeout.o restart.o writeout_nc.o radlib3d.o irrad3d.o sorad3d.o radtrns3d.o getcape.o ysu.o sfclay.o sfclayrev.o slab.o oml.o module_gfs_machine.o module_gfs_physcons.o module_gfs_funcphys.o module_sf_exchcoef.o module_sf_gfdl.o module_bl_gfsedmf.o module_ra_etc.o module_ra_rrtmg_lw.o module_ra_rrtmg_sw.o module_bl_mynn.o module_sf_mynn.o module_bl_myjpbl.o module_sf_myjsfc.o -Mfree -O2 -Ktrap=none -Mautoinline -Minline=reshape -acc -gpu=cuda11.4 -Minfo=accel -I/usr/local/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.9/cuda/11.4/include -L/usr/local/lib -L/opt/nvidia/hpc_sdk/Linux_x86_64/21.9/cuda/11.4/lib64 -lnetcdf -lnetcdff -lnvToolsExt -o ../run/cm1.exe
/usr/bin/ld: cm1.o: in function `MAIN_':
/home/shared/cm1r20.3/src/cm1.f90:2790: undefined reference to `nvtxstartrange_'
/usr/bin/ld: /home/shared/cm1r20.3/src/cm1.f90:2864: undefined reference to `__nvhpc_nvtxRangePopVoid'
/usr/bin/ld: /home/shared/cm1r20.3/src/cm1.f90:2866: undefined reference to `nvtxstartrange_'
/usr/bin/ld: /home/shared/cm1r20.3/src/cm1.f90:2939: undefined reference to `__nvhpc_nvtxRangePopVoid'
/usr/bin/ld: /home/shared/cm1r20.3/src/cm1.f90:2965: undefined reference to `nvtxstartrange_'
/usr/bin/ld: /home/shared/cm1r20.3/src/cm1.f90:3036: undefined reference to `__nvhpc_nvtxRangePopVoid'
pgacclnk: child process exit status 1: /usr/bin/ld
make: *** [Makefile:216: cm1] Error 2

Hi y.juntao,

I’m assuming you’re using the NVTX module that ships with the compilers? If so, try linking against our NVTX wrapper library, “-lnvhpcwrapnvtx”, rather than -lnvToolsExt directly.

-Mat

1 Like

Thanks Mat, problem solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.