llnl / llnl/AMG

Regarding the issue of failure in running due to errors during the conversion of `amg.c` into intermediate code

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
36
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Perhaps this is a strange question, and I am not sure if the project author is still actively involved in it, but I thought I would give it a try and inquire. Here's the situation: Firstly, I have successfully built the project using the make command. However, when I attempted to compile and run amg.c separately using different approaches (I am using the Clang compiler), I encountered the following issues:
1. `amg.c` can be successfully compiled into an executable file directly using Clang, and it can run smoothly. The command is as follows:
`clang -fopenmp -o test4 amg.c -I.. -I../utilities -I../IJ_mv -I../seq_mv -I../parcsr_mv -I../parcsr_ls -I../krylov -DTIMER_USE_MPI -DHYPRE_USING_OPENMP -DHYPRE_HOPSCOTCH -DHYPRE_USING_PERSISTENT_COMM -DHYPRE_BIGINT -DHYPRE_TIMING -lmpi -L. -L../parcsr_ls -L../parcsr_mv -L../IJ_mv -L../seq_mv -L../krylov -L../utilities -lparcsr_ls -lparcsr_mv -lseq_mv -lIJ_mv -lkrylov -lHYPRE_utilities -lm`
2. However, when I followed the steps below to convert `amg.c` into an executable file, I encountered different errors during the execution:

`clang -S -emit-llvm -o amgtest.ll amgtest.c`
`clang amgtest.ll -fopenmp -DTIMER_USE_MPI -DHYPRE_USING_OPENMP -DHYPRE_HOPSCOTCH -DHYPRE_USING_PERSISTENT_COMM -DHYPRE_BIGINT -DHYPRE_TIMING -lmpi -L. -L../parcsr_ls -L../parcsr_mv -L../IJ_mv -L../seq_mv -L../krylov -L../utilities -lparcsr_ls -lparcsr_mv -lseq_mv -lIJ_mv -lkrylov -lHYPRE_utilities -lm -o test4 -g `
`mpirun -np 4 test4`
Output:
![p1](https://github.com/LLNL/AMG/assets/40415574/633b9c2b-9568-4852-8058-fb5f2b34938f)

`clang -S -emit-llvm -o amgtest.ll amgtest.c`
`llvm-as amgtest.ll -o amgtest.bc`
`llc amgtest.bc -o amgtest.s`
`clang amgtest.s -no-pie -fopenmp -DTIMER_USE_MPI -DHYPRE_USING_OPENMP -DHYPRE_HOPSCOTCH -DHYPRE_USING_PERSISTENT_COMM -DHYPRE_BIGINT -DHYPRE_TIMING -lmpi -L. -L../parcsr_ls -L../parcsr_mv -L../IJ_mv -L../seq_mv -L../krylov -L../utilities -lparcsr_ls -lparcsr_mv -lseq_mv -lIJ_mv -lkrylov -lHYPRE_utilities -lm -o test4 -g`
`mpirun -np 4 test4`
Output:
![p2](https://github.com/LLNL/AMG/assets/40415574/7d7015bb-6ff1-4586-85a2-0cb2e0ce4bda)
I identified the function where the error occurred through GDB debugging. After adding some debugging information, I found that the issue was related to the `IJ_A` structure.
![p3](https://github.com/LLNL/AMG/assets/40415574/46885d52-34a9-4768-8336-f228ce702a66)
I suspect that the error occurred during the conversion of the `amg.c` code into intermediate code due to the complexity of the `IJ_A` structure. This may have resulted in some unexpected errors, leading to the final error. I have ruled out the issue of compiler versions (as I have tried Clang 3.8, Clang 4.0, and Clang 3.0). Could it be a problem with the code itself? Have the authors encountered similar errors before? (Since my current research is in code optimization/profiling, I need to manipulate the intermediate code of `amg.c`). Do you have any suggestions? Thank you very much!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with amg.c and the IJ_A structure, then reproduce the make-built executable and the Clang LLVM pipeline described in the issue. Use GDB at the reported failing function to compare IJ_A across both runs. Done means identifying whether the discrepancy is introduced during compilation or execution and documenting a reproducible cause or required project change.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers, hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.