Coder Social home page Coder Social logo

Comments (3)

ouankou avatar ouankou commented on July 20, 2024

In this case, multiple branches in metadirective need to be executed concurrently. Therefore, we may need a new modifier in when and default clauses to indicate this intention.
The condition evaluation updates the controlling variable in the loop so that different branches can pick up their own partial workload.
In the following example, joint means as long as the condition is met, this branch will be executed. The variables in this clause means that the branch will have a private copy of those variables so that it can work on its own share of loop iterations.

#define CPU 0
#define GPU 1
#pragma omp metadirective \
    when(joint(start, end), condition(model(N, GPU, &start, &end) == 1) : target teams distribute parallel for) \
    when(joint(start, end), condition(model(N, CPU, &start, &end) == 0) : parallel for)
        for (i = start; i < end; i++)
            ... // loop body

from llnl-work-notes.

ouankou avatar ouankou commented on July 20, 2024

The description of ODDC model has been added to Overleaf.

from llnl-work-notes.

ouankou avatar ouankou commented on July 20, 2024

The implementation of ODDC has been added to GitHub.
https://github.com/ouankou/whiteboard/blob/master/openmp/stencil_oddc_metadirective.c

Based on the testing results on Pascal:
For smaller problem sizes, such as 16 and 32, the overhead and incorrect prediction of CPU/GPU performance make the ODDC model less useful.
For a medium problem size, such as 512, ODDC is as fast as FPM.
For larger problem sizes, such as 2048 and 4096, ODDC is faster than FPM. However, it's still not the optimal performance as expected. The reason is that ODDC can correctly find out whether CPU or GPU is faster, but not how exactly faster it is. However, to split the workload properly, ODDC needs to know the accurate performance data of CPU and GPU. Otherwise, it will miscalculate the balanced working time of CPU and GPU.

According to the breakdown of ODDC time cost, we can see that the bottleneck is CPU computing. The predicted CPU performance from ODDC is higher than the ground truth. Therefore, it assigns more workload to CPU incorrectly. GPU has to stay idle to wait for CPU.
If we manually assign the workload, the ODDC could be even faster. For larger problem sizes, CPU should take 25% workload while GPU takes 75%. In current ODDC model, CPU takes about 40%.

from llnl-work-notes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.