Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Multiprecision Build #1132

Draft
wants to merge 91 commits into
base: master
Choose a base branch
from
Draft

WIP: Multiprecision Build #1132

wants to merge 91 commits into from

Conversation

oseikuffuor1
Copy link
Contributor

@oseikuffuor1 oseikuffuor1 commented Sep 18, 2024

This PR will introduce multiprecision capabilities into master.

hypre currently supports single, double and longdouble precision in independent builds. This PR will enable an interoperable build of hypre in the different precisions. This will enable mixed-precision code development in hypre. Key components include:

  1. An updated build system that allows building hypre with multiprecision capabilties turned on
  2. Scripts to check and update the multiprecision build
  3. New header files that identify multiprecision functions
  4. Mixed-precision Krylov solver capabilities
  5. Capability to use a different operator for the preconditioner than the matrix operator (for Krylov solvers)

To Do:

  1. Cleanup warnings/ errors on macOS, etc.
  2. Fixes for memory alignment bug
  3. Updated mixed-precision AMG utilizing fixes in 1.
  4. Review from the hypre team

…or directives.

Also updated HYPRE_utilities header file to include multiprecision header file.
HYPRE_Precision vector_precision;
#endif

} hypre_Vector_mp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both hypre_Vector_mp and hypre_Vector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes actually. This was necessary to allow mixed-precision vector operations. However, when To Do item 2 is completed, this may take on a different form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! It would be nice to remove the duplications if we could

@victorapm
Copy link
Contributor

I'm seeing an error when building on a Mac ./configure --enable-mixed-precision

mpicc -O2  -DHAVE_CONFIG_H -I.. -I. -I./.. -I./../utilities           -c seq_mv_mp.c
seq_mv_mp.c:115:10: error: call to undeclared function 'hypre_error_handler_dbl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         hypre_error_w_msg_mp(HYPRE_ERROR_GENERIC, "Error: Undefined precision type for Vector Copy!\n");
         ^
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^
seq_mv_mp.c:115:10: note: did you mean 'hypre_error_handler'?
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^
./../utilities/_hypre_utilities.h:678:6: note: 'hypre_error_handler' declared here
void hypre_error_handler(const char *filename, HYPRE_Int line, HYPRE_Int ierr, const char *msg);
     ^
./../utilities/utilities_mup_func.h:52:57: note: expanded from macro 'hypre_error_handler'
#define hypre_error_handler HYPRE_MULTIPRECISION_FUNC ( hypre_error_handler )
                                                        ^
seq_mv_mp.c:173:10: error: call to undeclared function 'hypre_error_handler_dbl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         hypre_error_w_msg_mp(HYPRE_ERROR_GENERIC, "Error: Undefined precision type for Vector Axpy!\n");
         ^
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^

@oseikuffuor1
Copy link
Contributor Author

I'm seeing an error when building on a Mac ./configure --enable-mixed-precision

mpicc -O2  -DHAVE_CONFIG_H -I.. -I. -I./.. -I./../utilities           -c seq_mv_mp.c
seq_mv_mp.c:115:10: error: call to undeclared function 'hypre_error_handler_dbl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         hypre_error_w_msg_mp(HYPRE_ERROR_GENERIC, "Error: Undefined precision type for Vector Copy!\n");
         ^
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^
seq_mv_mp.c:115:10: note: did you mean 'hypre_error_handler'?
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^
./../utilities/_hypre_utilities.h:678:6: note: 'hypre_error_handler' declared here
void hypre_error_handler(const char *filename, HYPRE_Int line, HYPRE_Int ierr, const char *msg);
     ^
./../utilities/utilities_mup_func.h:52:57: note: expanded from macro 'hypre_error_handler'
#define hypre_error_handler HYPRE_MULTIPRECISION_FUNC ( hypre_error_handler )
                                                        ^
seq_mv_mp.c:173:10: error: call to undeclared function 'hypre_error_handler_dbl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         hypre_error_w_msg_mp(HYPRE_ERROR_GENERIC, "Error: Undefined precision type for Vector Axpy!\n");
         ^
./../utilities/_hypre_utilities.h:683:42: note: expanded from macro 'hypre_error_w_msg_mp'
#define hypre_error_w_msg_mp(IERR, msg)  hypre_error_handler_dbl(__FILE__, __LINE__, IERR, msg)
                                         ^

Thanks Victor. This appears as a warning for me (and I believe Rob as well) on my Mac. I intend to clean this and other warnings up. I should have listed that in the to-dos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants