nv-nsight-cu-cli error: Invalid or unsupported charset:UTF-8

I’m unable to use nv-nsight-cu-cli on a system running Yocto Linux (Poky). There seems to be an issue with boost::locale complied into nv-nsight-cu-cli. My test program is compiled with gcc 4.9.3 and glibc 2.23. I’ve tried NVIDIA Compute 1.0 and 2019.4.0 from the Ubuntu 14.04 and 16.04 Debian installers. You can see from the program output below that std::locale appears to be working. I’ve tried rebuilding the en_US.UTF-8 locale with localedef, but that doesn’t resolve the issue. Please help, and thanks!

My test program:

#include <cuda_runtime_api.h>
#include <stdio.h>
#include <locale>
#include <iostream>

int main()
{
    std::wcout << "User-preferred locale setting is " << std::locale("").name().c_str() << '\n';
    std::wcout << 1000.01 << '\n';
    std::locale::global(std::locale(""));
    std::wcout.imbue(std::locale());
    std::wcout << 1000.01 << '\n';

    std::wcout << "START" << '\n';
    cudaDeviceSynchronize();
    std::wcout << "END" << '\n';
    return 0;
}

Program output when run standalone ./test:

User-preferred locale setting is C
1000.01
1000.01
START
END

Program output when run as LANG=en_US.UTF-8 ./test:

User-preferred locale setting is en_US.UTF-8
1000.01
1,000.01
START
END

Program output with Compute 2019.4.0… nv-nsight-cu-cli ./test:

User-preferred locale setting is C
1000.01
1000.01
START
terminate called after throwing an instance of 'N5boost6locale4conv21invalid_charset_errorE'
  what():  Invalid or unsupported charset:ANSI_X3.4-1968
==ERROR== The application returned an error code (6)
==WARNING== No kernels were profiled
==WARNING== Profiling kernels launched by child processes requires the --target-processes all option

Program output with Compute 2019.4.0… LANG=en_US.UTF-8 nv-nsight-cu-cli ./test:

User-preferred locale setting is en_US.UTF-8
1000.01
1,000.01
START
terminate called after throwing an instance of 'N5boost6locale4conv21invalid_charset_errorE'
  what():  Invalid or unsupported charset:ANSI_X3.4-1968
==ERROR== The application returned an error code (6)
==WARNING== No kernels were profiled
==WARNING== Profiling kernels launched by child processes requires the --target-processes all option

Program output with Compute 1.0… nv-nsight-cu-cli ./test:

User-preferred locale setting is C
1000.01
1000.01
START
terminate called after throwing an instance of 'N5boost6locale4conv21invalid_charset_errorE'
  what():  Invalid or unsupported charset:ANSI_X3.4-1968
==PROF== ERROR: Target application terminated before first instrumented API call.

Program output with Compute 1.0… LANG=en_US.UTF-8 nv-nsight-cu-cli ./test:

User-preferred locale setting is en_US.UTF-8
1000.01
1,000.01
START
terminate called after throwing an instance of 'N5boost6locale4conv21invalid_charset_errorE'
  what():  Invalid or unsupported charset:UTF-8
==PROF== ERROR: Target application terminated before first instrumented API call.

I’m also affected. Is there a workaround?

tno, please let us know which exact version of Nsight Compute you are using, on which OS, and what is the exact error you are seeing. If you are using a version prior to 2019.5, please consider testing again with the latest released version.

vtproye, are you seeing the same issues on e.g. Ubuntu 16.04 or later when using the same application and same locale setting as on your Yocto Linux (Poky) system? I am unable to replicate the issue so far on Ubuntu 16.04 with your test application and any version of Nsight Compute.

It might help if you could let us know the output of

locale

and

locale -a

on your system.

Thanks for your reply.
I’m using Nsight Compute 2019.5.
The target platform (x86_64, custom/minimal Linux) has no locale command and an empty /usr/share/locale/. Is that possibilty supported?

This is the exact error message that I get:

Checking file deployment: libInterceptorInjectionTarget.so
Checking file deployment: libTreeLauncherPlaceholder.so
Checking file deployment: libTreeLauncherTargetInjection.so
Checking file deployment: libTreeLauncherTargetUpdatePreloadInjection.so
Checking file deployment: TreeLauncherTargetLdPreloadHelper
Checking file deployment: libcuda-injection.so
Checking file deployment: libInterceptorInjectionTarget.so
Checking file deployment: libnvperf_host.so
Checking file deployment: libnvperf_target.so
Checking file deployment: libnvperfapi64.so
Checking file deployment: libNvSwCounterApi.so
Checking file deployment: libTreeLauncherPlaceholder.so
Checking file deployment: libTreeLauncherTargetInjection.so
Checking file deployment: libTreeLauncherTargetUpdatePreloadInjection.so
Checking file deployment: nv-nsight-cu-cli
Checking file deployment: TreeLauncherSubreaper
Checking file deployment: TreeLauncherTargetLdPreloadHelper
Checking file deployment: ComputeWorkloadAnalysis.section
Checking file deployment: CPIStallBarrier.py
Checking file deployment: CPIStallDispatchStall.py
Checking file deployment: CPIStallDrain.py
Checking file deployment: CPIStallImcMiss.py
Checking file deployment: CPIStallLgThrottle.py
Checking file deployment: CPIStallLongScoreboard.py
Checking file deployment: CPIStallMathPipeThrottle.py
Checking file deployment: CPIStallMembar.py
Checking file deployment: CPIStallMioThrottle.py
Checking file deployment: CPIStallMisc.py
Checking file deployment: CPIStallNoInstructions.py
Checking file deployment: CPIStallNotSelected.py
Checking file deployment: CPIStallShortScoreboard.py
Checking file deployment: CPIStallSleeping.py
Checking file deployment: CPIStallTexThrottle.py
Checking file deployment: CPIStallWait.py
Checking file deployment: InstructionStatistics.section
Checking file deployment: IssueSlotUtilization.py
Checking file deployment: LaunchStatistics.py
Checking file deployment: LaunchStatistics.section
Checking file deployment: MemoryWorkloadAnalysis.section
Checking file deployment: MemoryWorkloadAnalysis_Chart.section
Checking file deployment: MemoryWorkloadAnalysis_Tables.section
Checking file deployment: NvRules.py
Checking file deployment: Occupancy.section
Checking file deployment: SchedulerStatistics.section
Checking file deployment: SlowPipeLimiter.py
Checking file deployment: SourceCounters.section
Checking file deployment: SpeedOfLight.py
Checking file deployment: SpeedOfLight.section
Checking file deployment: ThreadDivergence.py
Checking file deployment: WarpStateStatistics.section
/tmp/my_cuda_app
Launching: my_cuda_app (host: 10.16.12.24)
Process launched
Trying to connect to process...
Trying to connect to process on host: 10.16.12.24...
my_cuda_app: <some debug infos>

terminate called after throwing an instance of 'N5boost6locale4conv21invalid_charset_errorE'
  what():  Invalid or unsupported charset:ANSI_X3.4-1968

Process exited (0)

I tried setting LC_ALL= to different values in Target plaform -> Launch -> Environment, but it didn’t help.

In my case, it turned out that gconv was missing. I resolved the issue on my system by adding glibc-gconvs to TOOLCHAIN_TARGET_TASK in my Yocto setup. Hope this helps!

tno, can you check if gconv might be missing from your system, too? It’s the GNU version of iconv, which is used for character encoding conversion, i.e. it would be very applicable to this issue.