with one click
paracodex-serial-omp-step1
ParaCodex prompt for serial omp step1 step.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
ParaCodex prompt for serial omp step1 step.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
ParaCodex baseline skill: translate serial / parallel code to GPU-offloaded target API, optimize, compile, and run — all in a single session.
ParaCodex prompt for cuda to hip analysis step.
ParaCodex prompt for cuda to hip step1 (implementation) step.
ParaCodex prompt for cuda to hip step2 (optimization) step.
ParaCodex prompt for cuda ocl analysis step.
ParaCodex prompt for cuda ocl step1 step.
Based on SOC occupation classification
| name | paracodex-serial-omp-step1 |
| description | ParaCodex prompt for serial omp step1 step. |
Directory: {kernel_dir}/
Files: {file_listing}
Reference: {kernel_dir}/analysis.md
Required:
OMP_TARGET_OFFLOAD=MANDATORY for all runstarget teams loop first for OpenMP 5+ GPU offload, but keep or switch to target teams distribute parallel for when it produces better device code or more reliable compiler/runtime behavior on this target.IMPORTANT: YOU MAY MODIFY THE MAKEFILE TO ADD ANYTHING YOU NEED TO RUN THE CODE.
Structural Goal: Choose the right offload unit before adding pragmas. Do not preserve a weak serial helper decomposition if a fused or flattened OpenMP offload unit will perform better.
Save backup of {file_listing}.
cd {kernel_dir}
{clean_cmd_str}
timeout 300 {correctness_run_cmd} > baseline_output.txt 2>&1
# Fallback: timeout 60 {correctness_fallback_cmd} > baseline_output.txt 2>&1
grep -E "Verification|SUCCESSFUL|FAILED" baseline_output.txt
DO NOT SKIP THIS STEP.
Walk through IN ORDER, stop at first match:
RULE 1: Type B (Sparse/CSR)? → STRATEGY A/C
RULE 2: Type C1 (Iterative Solvers). → STRATEGY C
RULE 3: Type C2 (Multigrid)? → STRATEGY A
RULE 4: Outer A + inner E (per-thread RNG) → STRATEGY A
RULE 5: Multiple independent kernels? → STRATEGY B
RULE 6: Otherwise → STRATEGY A
MANDATORY: Create data_plan.md in {kernel_dir} using the template in references/output.md.
Reference: references/output.md (Use entire file as template).
FIRST: Check if original algorithm can be simplified for GPU:
Rule: If scratch arrays exist ONLY to avoid atomics on small data (<1KB), DELETE them and use per-thread locals + atomic merge instead.
Block elimination: If code has for (blk = 0; blk < numblks; blk++) with scratch arrays,
this is a CPU cache optimization. For GPU: remove blocking, parallelize over all N items directly.
CUDA-serial port (Type H): Eliminate the inner fake-thread loop entirely. Rewrite as scalar logic per outer work-item. Remove from map clauses any arrays only accessed inside the eliminated loop.
Analyze ALL arrays and functions in the timed region to fill the plan.
system_info_summary.txt; push to the largest short-run, memory-safe input that should load the GPU meaningfully on this device.CRITICAL: After creating data_plan.md, you MUST proceed to Implement Data Plan in this same step1 phase. Do not stop after planning.
Use data_plan.md as implementation guide.
Reference: references/examples.md (Contains Code Examples, Map Clauses, and Parallelization Patterns).
From "Arrays Inventory" and "Data Movement Strategy" in your plan:
references/examples.md for STRATEGY A/B/C details).From "H→D Transfers" and "D→H Transfers" sections:
Use "Functions in Timed Region" table:
references/examples.md).Follow "Data Movement Strategy" timing:
[setup from plan]
[H→D transfers at specified time]
[timed computation - call functions]
[D→H transfers at specified time]
[cleanup]
system_info_summary.txt. The target is the largest short-run, memory-safe size that should use the device meaningfully, not merely a modest increase over the default.CRITICAL: Update Makefile to ensure it compiles successfully.
common/, utilities/).source variable to include all required source files.obj variable.CFLAGS += -Icommon).make -f Makefile.nvc works.<RUN_ARGS>, <PROGRAM_NAME>, <SOURCE_FILES>, etc.) with real values.Makefile.nvc supports a plain make -f Makefile.nvc run with no ad hoc variable overrides.{clean_cmd_str}
{build_cmd_str}
timeout 300 {correctness_run_cmd} > gpu_output.txt 2>&1
# Fallback: timeout 60 {correctness_fallback_cmd} > gpu_output.txt 2>&1
If timeout/segfault: Remove #pragma omp loop from Type C inner loops.
diff baseline_output.txt gpu_output.txt
{clean_cmd_str}
{nsys_profile_cmd} > {profile_log_path} 2>&1
# Fallback: {nsys_profile_fallback_cmd} > {profile_log_path} 2>&1
grep -E "cuda_gpu_kern|CUDA GPU Kernel|GPU activities" {profile_log_path} | head -10 || echo "No kernel information found"
Before finishing step1, verify all of the following:
target update operations in the timed region.Makefile.nvc and related files contain no unresolved placeholders.make -f Makefile.nvc run succeeds as the final run check.{nsys_profile_cmd} > {profile_log_path} 2>&1 produces GPU kernel information in the log.