Error in Event Sampling with CUPTI Event API

I am trying to work with the CUPTI library in CUDA to read some event counters. When executing the sample provided with CUPTI installation (/usr/local/cuda-11.3/extras/CUPTI/samples/event_sampling) it says “CUPTI_ERROR_INSUFFICIENT_PRIVILEGES for CUPTI API function ‘cuptiEventGroupEnable’”. How can i solve this error?

I am using CUDA toolkit 11.3 on my 64-bit ubuntu 18.04 machine with Geforce GTX 1070 GPU

ERROR:

mehran@Temp1804:/usr/local/cuda-11.3/extras/CUPTI/samples/event_sampling$ ./a.out
Usage: ./a.out [device_num] [event_name]
CUDA Device Number: 0
CUDA Device Name: NVIDIA GeForce GTX 1070
Compute Capability of Device: 6.1
Creating sampling thread
event_sampling.cu:92:Error CUPTI_ERROR_INSUFFICIENT_PRIVILEGES for CUPTI API function 'cuptiEventGroupEnable'.

Follow the instructions at