GNU GMP and MPI

June Co. juneco at quartz.ocn.ne.jp
Fri Mar 21 12:58:58 CET 2008


Hi, Mitesh.

On 2008/03/20, at 22:33, Mitesh Gupta wrote:
> HI,
> Kindly help me in how can i send mpf_t over MPI Send and also how  
> to receive it.

The struct of GMP''s mpf_t is constructed to be separated mantissa  
and other parts (exponent, sign and precision). So, it is necessary  
to pack them before you'll use mpi_send.

I wish that such "packing" functions are officially supported in GMP  
and MPFR.

There are two ways I've already known.

1.  convert mpf_t's bits to text string by using mpf_get_str function.
Ref.) http://gmplib.org/list-archives/gmp-discuss/2002-December/ 
000194.html

2. use memcpy to pack like "pack_mpf" function in my BNCpack ->  
http://na-inet.jp/na/bnc/bnc-0.6b.tar.gz .

Sample source is http://na-inet.jp/tutorial/03/mpi-sr-gmp.c. If you  
want to use pure gmp without mpfr, you delete lines of "#define  
USE_MPFR" and "#include "mpfr.h" and then compile it.

I hope you'll success to mpi_send with gmp.



More information about the gmp-discuss mailing list