How does a piece of code run using XLA_CPU:0, XLA:GPU:0, GPU:0, respectively on xavier

Suppose now I have a piece of code to run as follows


int main()
    int i=0;
    for(i=0; i<100000; i++)
    return 0;

I put this code on Xavier to compile and run. I want to test the performance of this code on CPU and different GPUs of xavier. How can I specify the device I want to use?

I suddenly found that what I look for is DLA. So I added DLA to my code. But at runtime, sometimes the same piece of code has a segment error, and sometimes it runs correctly, which I am very confused about.


DLA is our inference engine and it’s required to be triggered with TensorRT.
Your sample doesn’t look like a TensorRT application.

Would you mind to share the complete source code with us so we can give a further suggestion?