ch1_mpi 1 #include "mpi.h"
ch1_mpi 2 #include <stdlib.h>
ch1_mpi 3
ch1_mpi 4 void err(char *msg)
ch1_mpi 5 {
ch1_mpi 6 fprintf(stderr, "%s\n", msg);
ch1_mpi 7 exit(1);
ch1_mpi 8 }
ch1_mpi 9
ch1_mpi 10 void terpri(FILE *fp)
ch1_mpi 11 {
ch1_mpi 12 fprintf(fp, "\n");
ch1_mpi 13 }
ch1_mpi 14
ch1_mpi 15 int main(int ac, char **av)
ch1_mpi 16 {
ch1_mpi 17 MPI a, b, y;
ch1_mpi 18 int r;
ch1_mpi 19
ch1_mpi 20 r = secmem_init(1000);
ch1_mpi 21 if (r==0) err("secmem init");
ch1_mpi 22
ch1_mpi 23 a = mpi_alloc_secure(0);
ch1_mpi 24 b = mpi_alloc_secure(0);
ch1_mpi 25 y = mpi_alloc_secure(0);
ch1_mpi 26 mpi_fromstr(a, "0x1B0B206C488601");
ch1_mpi 27 mpi_fromstr(b, "0x20E92FE28E1929");
ch1_mpi 28 mpi_mul(y, a, b);
ch1_mpi 29 mpi_free(a);
ch1_mpi 30 mpi_free(b);
ch1_mpi 31
ch1_mpi 32 mpi_print(stdout, y, 1);
ch1_mpi 33 mpi_free(y);
ch1_mpi 34
ch1_mpi 35 terpri(stdout);
ch1_mpi 36 secmem_term();
ch1_mpi 37
ch1_mpi 38 return 0;
ch1_mpi 39 }