https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101544

--- Comment #12 from Benjamin Schulz <schulz.benjamin at googlemail dot com> ---
In my view, not only the new command is important, but also things like printf,
which also does not exist on the target, apparently.

The problem is that with openmp, you can only check whether you are really on
the target or on the host, by doing:

        if(omp_is_initial_device()!=true)
        {
            printf("firsttest runs on target\n");
        }
        else
            printf("runs on host");

On clang, this would work. 


On my system, with 1 cpu and 1 gpu, on clang it turned out that the omp device
number was always 1. 

The map commands on device 0 would map to the gpu. However, target enter data
and target exit data on device 0 would be confused, with a map(alloc..) on
device 0 erasing the host data. 

And a target enter data on device 1 would make everything work on the host.

After this experience on clang, I would use this test


        if(omp_is_initial_device()!=true)
        {
            printf("firsttest runs on target\n");
        }
        else
            printf("runs on host");

rather often. On gcc, this appears not to be available. Compilation of such a
simple statement fails on gpu target with

"unresolved symbol __printf_chk"


This is somewhat embarassing. 

The gpu should be able to print text out, as it can even render entire
videogames.


To have commands that print out text is just necessary for debugging of more
complex code. 

But the same could be said with exceptions. Using the stl apparently fails
because these classes use nonlocal goto commands, aka exceptions...

Reply via email to