83 int rank,nproc,nglobal,nrhs,i,s,ia,ib,desca[9],descb[9],ierr,
85 double *dl,*d,*du,*rhs,*work;
86 struct timeval start,end;
93 MPI_Comm *comm = (MPI_Comm*) m;
96 MPI_Comm_size(*comm,&nproc);
97 MPI_Comm_rank(*comm,&rank);
102 MPI_Allreduce(&n,&nglobal,1,MPI_INT,MPI_SUM,*comm);
106 if (nglobal%n != 0) {
108 fprintf(stderr,
"Error: The ScaLAPACK wrapper can only handle cases where the global ");
109 fprintf(stderr,
"size of system is an integer multiple of no. of processes.\n");
115 fprintf(stderr,
"Error in tridiagLU(): NULL pointer passed for parameters.\n");
124 lwork = (12*nproc+3*n) + ( (8*nproc) > (10*nproc+4*nrhs) ? (8*nproc) : (10*nproc+4*nrhs) );
146 dl = (
double*) calloc (n,
sizeof(
double));
147 d = (
double*) calloc (n,
sizeof(
double));
148 du = (
double*) calloc (n,
sizeof(
double));
149 rhs = (
double*) calloc (n,
sizeof(
double));
150 work = (
double*) calloc(lwork,
sizeof(
double));
157 for (s=0; s<ns; s++) {
159 for (i=0; i<n; i++) {
167 gettimeofday(&start,NULL);
168 pddtsv_(&nglobal,&nrhs,dl,d,du,&ia,desca,rhs,&ib,descb,work,&lwork,&ierr);
169 gettimeofday(&end,NULL);
170 if (ierr)
return(ierr);
172 for (i=0; i<n; i++) x[i*ns+s] = rhs[i];
175 walltime = ((end.tv_sec * 1000000 + end.tv_usec) - (start.tv_sec * 1000000 + start.tv_usec));
176 params->
total_time += (double) walltime / 1000000.0;
Header file for TridiagLU.
int tridiagScaLPK(double *a, double *b, double *c, double *x, int n, int ns, void *r, void *m)