# PGPROF "internal error: invalid thread id"

**URL:** <https://forums.developer.nvidia.com/t/pgprof-internal-error-invalid-thread-id/133609>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [May 8, 2013, 2:04pm UTC](https://forums.developer.nvidia.com/t/pgprof-internal-error-invalid-thread-id/133609 "2013-05-08T14:04:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcwarren](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dcwarren](https://forums.developer.nvidia.com/u/dcwarren)\
**Post date:** [May 8, 2013, 2:04pm UTC](https://forums.developer.nvidia.com/t/pgprof-internal-error-invalid-thread-id/133609/1 "2013-05-08T14:04:12Z")

</div>

I’m trying to profile some CUDA code (written in Fortran, if it makes a difference), and I know I need to use several flags at compilation and runtime as follows:

```nohighlight
> pgfortran -o foo.exe -Minfo=ccff -Mcuda -ta=nvidia foo.f90
> pgcollect -cuda foo.exe < input.file

```

If I use only those flags, my code will run to completion, but I do not get a lot of useful information out of PGPROF when I try to profile the code. So the next step is to use the flags -Mprof=func or -Mprof=lines at compile time. However, when I run pgcollect, I get the following error:

```nohighlight
> pgfortran -o foo.exe -Minfo=ccff -Mprof=[lines or func] -Mcuda -ta=nvidia foo.f90

> pgcollect -cuda foo.exe < input.file
Error: internal error: invalid thread id
target process has terminated, writing profile data
PGCOLLECT: Fatal Error: No samples: out of range

```

That’s a whole lot of "error"s and colons to tell me that something went wrong, but I have no clue what that something is. Do I need to send an example to [trs@pgroup.com](mailto:trs@pgroup.com)?

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [May 9, 2013, 8:28pm UTC](https://forums.developer.nvidia.com/t/pgprof-internal-error-invalid-thread-id/133609/2 "2013-05-09T20:28:20Z")

</div>

> If I use only those flags, my code will run to completion, but I do not get a lot of useful information out of PGPROF when I try to profile the code.

The accelerator info gets shown in the bottom tab when the particular kernel is selected.

> So the next step is to use the flags -Mprof=func or -Mprof=lines at compile time. However, when I run pgcollect, I get the following error:

-Mprof and pgcollect can’t be used together. They use two entirely separate profiling mechanisms (instrumented vs sampling).

- Mat
