Comments (2)
Lines 35 to 50 in 403e28d
- Let say you have N devices available. The loop just says that you offload the code N times, but you don't specify to which device to offload, so probably it will be offloaded always to the same device. Am I right?
Yes, you're right, the code is incorrect. Line 38 should be
#pragma omp target device(i)
- Specification says that
omp_is_initial_device()
returns true (despite it is int) if the task is executed at a host device. You incrementnum_gpus
if the function returns 0 (false), and then at line 49 you say that offloading is possible if thenum_gpus > 0
.
I think this works as it should. If omp_is_initial_device()
returns false, i.e. A[0]==0
, we know the code was executed on a GPU, and num_gpus
is incremented.
- The condition at line 48 is the same as the condition at the following line, so there is a dead code.
I'm not exactly sure what you mean here, but line 48 should probably be removed, so that the status message is always printed.
I hope you get my point.
When executing your test application
omp_is_initial_device()
always returns 0.ldd
confirms, that the binary is linked with the libraries from the GCC (GCC-10.2.0 or GCC-7.3.0 + CUDA/10.2.89) I have compiled (libstdc++.so, libgomp.so, libgcc_s.so). Do you have an idea could be wrong?
Not sure, maybe it is picking the wrong libraries (or library versions)? Maybe try checking with nvprof
whether any code is executed on a device. Also, make sure you can run CUDA code correctly.
from omptest.
My problem was in misunderstanding the return value of the omp_is_initial_device()
. The code works fine now, thanks!
from omptest.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omptest.