How tanvirahmedkhan74/dynapex works
Main components of the system
• Main Application: Represented by src/main.cpp, which drives the overall execution.
• Dependency Analysis Module: Implemented in src/dependency_checker.cpp and its corresponding header in include/dependency_checker.h; its role is to analyze code sections for data dependencies.
• Pragma Injection Module: Found in src/pragma_injector.cpp (with header include/pragma_injector.h); this part dynamically inserts OpenMP pragmas to enable parallelism.
• Dynamic Dispatcher: Located in src/dispatcher.cpp (and its header include/dispatcher.h), which, based on profiling data, selects whether to dispatch tasks to the CPU (using OpenMP) or the GPU (using OpenMP target offloading).
• Build Artifacts & Logging: The build directory holds the compiled binaries (e.g., main_parallel, dispatcher), while the logs directory contains execution logs, GPU statistics, and dependency graphs, indicated by files like execution_log.txt and valgrind.dot.
• Test Modules: Additional source files such as test_1.cpp and test_2.cpp support verification and experimentation.
Detail the relationships and interactions
• The Main Application (main.cpp) orchestrates the execution by calling the dependency analysis and then invoking the dynamic dispatcher.
• The Dependency Checker feeds critical information into the Pragma Injector which, by modifying the code with proper OpenMP directives, enables parallel execution.
• The Dynamic Dispatcher is crucial: It utilizes the profiling output (collected during execution and recorded in the logs) and, based on execution mode (Normal, CPU, or GPU), directs the computation accordingly.
• External tools (like Valgrind, Graphviz, and gprof2dot) are integrated indirectly for profiling, visualization, and performance analysis. They aren’t coded into the system but play a supporting role in architecture.
Architectural patterns and design principles
• Modular Design: The separation into independent modules (dependency analysis, pragma injection, and dispatcher) shows a modular design that makes it easier to develop, test, and maintain.
• Dynamic Decision Making: The dynamic dispatcher employs real-time profiling data to optimize performance—a design pattern that leverages runtime feedback.
• Integration with External Profiling Tools: The architecture assumes an external instrumentation and profiling loop, seen in the logs output and profiling steps detailed in the README.
• Use of Standard Parallelization Libraries: OpenMP is explicitly used for parallelism on the CPU and selectively on the GPU (via target offloading), indicating reliance on industry-standard libraries.
Relevant technologies, frameworks, or libraries
• C++ as the primary language.
• OpenMP for parallelization on the CPU and GPU.
• GNU Make for the build process, as detailed in the Makefile.
• Profiling tools such as Valgrind and Graphviz, along with gprof2dot for visualization.
• GPU support (using NVIDIA’s CUDA Toolkit and proprietary drivers) even though GPU integration is not yet fully optimized for CUDA/OpenCL workflows.
Specific elements that must appear
• Clear labels for each module/component:
• "Main Application (main.cpp)"
• "Dependency Analyzer (dependency_checker.cpp / .h)"
• "Pragma Injector (pragma_injector.cpp / .h)"
• "Dynamic Dispatcher (dispatcher.cpp / .h)"
• "Build Artifacts & Binaries (build/)"
• "Log & Profiling Tools (logs/)"
• "Test Modules (test_1.cpp, test_2.cpp)"
• From Main Application to Dependency Analyzer.
• From Dependency Analyzer to Pragma Injector.
• From both dependency analysis and profiling logs to the Dynamic Dispatcher.
• From there, branch out to display dependency analysis and pragma injection (which work in sequence) leading to the Dynamic Dispatcher.
• On the side, incorporate the logging and profiling framework which feeds back into the dispatcher to influence execution mode decisions.
• Build and test components as supporting blocks.
• To include notes about the integration of OpenMP for both CPU and GPU and the dynamic runtime profiling that modulates execution strategy.