-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtoolsrout.tex
1880 lines (1677 loc) · 57.6 KB
/
toolsrout.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\section{Data management routines}
\label{sec:toolsrout}
%
%% psb_cdall %%
%
\subsection{psb\_cdall --- Allocates a communication descriptor}
\begin{verbatim}
call psb_cdall(icontxt, desc_a, info,mg=mg,parts=parts)
call psb_cdall(icontxt, desc_a, info,vg=vg,[mg=mg,flag=flag])
call psb_cdall(icontxt, desc_a, info,vl=vl,[nl=nl,globalcheck=.false.,lidx=lidx])
call psb_cdall(icontxt, desc_a, info,nl=nl)
call psb_cdall(icontxt, desc_a, info,mg=mg,repl=.true.)
\end{verbatim}
This subroutine initializes the communication descriptor associated
with an index space. One of the optional arguments
\verb|parts|, \verb|vg|, \verb|vl|, \verb|nl| or \verb|repl|
must be specified, thereby choosing
the specific initialization strategy.
\begin{description}
\item[\bf On Entry ]
\item[Type:] Synchronous.
\item[icontxt] the communication context.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer value.
\item[vg] Data allocation: each index $i\in \{1\dots mg\}$ is allocated
to process $vg(i)$.\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer array.
\item[flag] Specifies whether entries in $vg$ are zero- or one-based.\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer value $0,1$, default $0$.
\item[mg] the (global) number of rows of the problem.\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer value. It is required if \verb|parts| or
\verb|repl| is specified, it is optional if \verb|vg| is specified.
\item[parts] the subroutine that defines the partitioning scheme.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Specified as: a subroutine.
\item[vl] Data allocation: the set of global indices
$vl(1:nl)$ belonging to the calling process. \\
Scope:{\bf local}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer array.
\item[nl] Data allocation: in a generalized block-row distribution the
number of indices belonging to the current process. \\
Scope:{\bf local}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer value. May be specified together with
\verb|vl|.
\item[repl] Data allocation: build a replicated index space
(i.e. all processes own all indices).\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: the logical value \verb|.true.|
\item[globalcheck] Data allocation: do global checks on the local
index lists \verb|vl|\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: a logical value, default: \verb|.false.|
\item[lidx] Data allocation: the set of local indices
$lidx(1:nl)$ to be assigned to the global indices $vl$. \\
Scope:{\bf local}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer array.
\end{description}
\begin{description}
\item[\bf On Return]
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf out}.\\
Specified as: a structured data of type \descdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item One of the optional arguments \verb|parts|, \verb|vg|,
\verb|vl|, \verb|nl| or \verb|repl| must be specified, thereby choosing the
initialization strategy as follows:
\begin{description}
\item[parts] In this case we have a subroutine specifying the mapping
between global indices and process/local index pairs. If this
optional argument is specified, then it is mandatory to
specify the argument \verb|mg| as well.
The subroutine must conform to the following interface:
\begin{verbatim}
interface
subroutine psb_parts(glob_index,mg,np,pv,nv)
integer, intent (in) :: glob_index,np,mg
integer, intent (out) :: nv, pv(*)
end subroutine psb_parts
end interface
\end{verbatim}
The input arguments are:
\begin{description}
\item[glob\_index] The global index to be mapped;
\item[np] The number of processes in the mapping;
\item[mg] The total number of global rows in the mapping;
\end{description}
The output arguments are:
\begin{description}
\item[nv] The number of entries in \verb|pv|;
\item[pv] A vector containing the indices of the processes to
which the global index should be assigend; each entry must satisfy
$0\le pv(i) < np$; if $nv>1$ we have an index assigned to multiple
processes, i.e. we have an overlap among the subdomains.
\end{description}
\item[vg] In this case the association between an index and a process
is specified via an integer vector \verb|vg(1:mg)|;
each index $i \in \{1\dots mg\}$ is assigned to process $vg(i)$.
The vector \verb|vg| must be identical on all
calling processes; its entries may have the ranges $(0\dots np-1)$
or $(1\dots np)$ according to the value of \verb|flag|.
The size $mg$ may be specified via the optional argument \verb|mg|;
the default is to use the entire vector \verb|vg|, thus having
\verb|mg=size(vg)|.
\item[vl] In this case we are specifying the list of indices
\verb|vl(1:nl)| assigned to the current process; thus, the global
problem size $mg$ is given by
the range of the aggregate of the individual vectors \verb|vl| specified
in the calling processes. The size may be specified via the optional
argument \verb|nl|; the default is to use the entire vector
\verb|vl|, thus having \verb|nl=size(vl)|.
If \verb|globalcheck=.true.| the subroutine will check how many
times each entry in the global index space $(1\dots mg)$ is
specified in the input lists \verb|vl|, thus allowing for the
presence of overlap in the input, and checking for ``orphan''
indices. If \verb|globalcheck=.false.|, the subroutine will not
check for overlap, and may be significantly faster, but the user
is implicitly guaranteeing that there are neither orphan nor
overlap indices.
\item[lidx] The optional argument \verb|lidx| is available for
those cases in which the user has already established a
global-to-local mapping; if it is specified, each index in
\verb|vl(i)| will be mapped to the corresponding local index
\verb|lidx(i)|. When specifying the argument \verb|lidx| the user
would also likely employ \verb|lidx| in calls to \verb|psb_cdins|
and \verb|local| in calls to \verb|psb_spins| and \verb|psb_geins|;
see also sec.~\ref{sec:usermaps}.
\item[nl] If this argument is specified alone (i.e. without \verb|vl|)
the result is a generalized row-block distribution in which each
process $I$ gets assigned a consecutive chunk of $N_I=nl$ global
indices.
\item[repl] This arguments specifies to replicate all indices on
all processes. This is a special purpose data allocation that is
useful in the construction of some multilevel preconditioners.
\end{description}
\item On exit from this routine the descriptor is in the build
state.
\item Calling the routine with \verb|vg| or \verb|parts| implies that
every process will scan the entire index space to figure out the
local indices.
\item Overlapped indices are possible with both \verb|parts| and
\verb|vl| invocations.
\item When the subroutine is invoked with \verb|vl| in
conjunction with \verb|globalcheck=.true.|, it will perform a scan
of the index space to search for overlap or orphan indices.
\item When the subroutine is invoked with \verb|vl| in
conjunction with \verb|globalcheck=.false.|, no index space scan
will take place. Thus it is the responsibility of the user to make
sure that the indices specified in \verb|vl| have neither orphans nor
overlaps; if this assumption fails, results will be
unpredictable.
\item Orphan and overlap indices are
impossible by construction when the subroutine is invoked with
\verb|nl| (alone), or \verb|vg|.
\end{enumerate}
%
%% psb_cdins %%
%
\clearpage\subsection{psb\_cdins --- Communication descriptor insert
routine}
\begin{verbatim}
call psb_cdins(nz, ia, ja, desc_a, info [,ila,jla])
call psb_cdins(nz,ja,desc,info[,jla,mask,lidx])
\end{verbatim}
This subroutine examines the edges of the graph associated with the
discretization mesh (and isomorphic to the sparsity pattern of a
linear system coefficient matrix), storing them as necessary into the
communication descriptor. In the first form the edges are specified as
pairs of indices $ia(i),ja(i)$; the starting index $ia(i)$ should
belong to the current process.
In the second form only the remote indices $ja(i)$ are specified.
\begin{description}
\item[Type:] Asynchronous.
\item[\bf On Entry]
\item[nz] the number of points being inserted.\\
Scope: {\bf local}.\\
Type: {\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer value.
\item[ia] the indices of the starting vertex of the edges being inserted.\\
Scope: {\bf local}.\\
Type: {\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer array of length $nz$.
\item[ja] the indices of the end vertex of the edges being inserted.\\
Scope: {\bf local}.\\
Type: {\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer array of length $nz$.
\item[mask] Mask entries in \verb|ja|, they are inserted only when the
corresponding \verb|mask| entries are \verb|.true.|\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: a logical array of length $nz$, default \verb|.true.|.
\item[lidx] User defined local indices for \verb|ja|.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer array of length $nz$.
%% \item[is] the row offset.\\
%% Scope:{\bf local}.\\
%% Type:{\bf optional}.\\a
%% Specified as: an integer value.
%% \item[js] the column offset.\\
%% Scope: {\bf local}.\\
%% Type: {\bf optional}.\\
%% Specified as: an integer value.
\end{description}
\begin{description}
\item[\bf On Return]
\item[desc\_a] the updated communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \descdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\item[ila] the local indices of the starting vertex of the edges being inserted.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf out}.\\
Specified as: an integer array of length $nz$.
\item[jla] the local indices of the end vertex of the edges being inserted.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf out}.\\
Specified as: an integer array of length $nz$.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item This routine may only be called if the descriptor is in the
build state;
\item This routine automatically ignores edges that do not
insist on the current process, i.e. edges for which neither the starting
nor the end vertex belong to the current process.
\item The second form of this routine will be useful when dealing with
user-specified index mappings; see also~\ref{sec:usermaps}.
\end{enumerate}
%
%% psb_cdasb %%
%
\clearpage\subsection{psb\_cdasb --- Communication descriptor assembly
routine}
\begin{verbatim}
call psb_cdasb(desc_a, info [, mold])
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \descdata.
\item[mold] The desired dynamic type for the internal index storage.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: a object of type derived from (integer) \vbasedata.
\end{description}
\begin{description}
\item[\bf On Return]
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \descdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
%\item[arg]
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item On exit from this routine the descriptor is in the assembled
state.
\end{enumerate}
This call will set up all the necessary information for the halo data
exchanges. In doing so, the library will need to identify the set of
processes owning the halo indices through the use of the
\verb|desc%fnd_owner()| method; the owning processes are the
topological neighbours of the calling process. If the user has some
background information on the processes that are neighbours of the
current one, it is possible to specify explicitly the list of adjacent
processes with a call to \verb|desc%set_p_adjcncy(list)|; this will
speed up the subsequent call to \verb|psb_cdasb|.
%
%% psb_cdcpy %%
%
\clearpage\subsection{psb\_cdcpy --- Copies a communication descriptor}
\begin{verbatim}
call psb_cdcpy(desc_in, desc_out, info)
\end{verbatim}
\begin{description}
\item[Type:] Asynchronous.
\item[\bf On Entry]
\item[desc\_in] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data of type \descdata.
\end{description}
\begin{description}
\item[\bf On Return]
\item[desc\_out] the communication descriptor copy.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf out}.\\
Specified as: a structured data of type \descdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
%
%% psb_cdfree %%
%
\clearpage\subsection{psb\_cdfree --- Frees a communication descriptor}
\begin{verbatim}
call psb_cdfree(desc_a, info)
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[desc\_a] the communication descriptor to be freed.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \descdata.
\end{description}
\begin{description}
\item[\bf On Return]
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
%
%% psb_cdcpy %%
%
\clearpage\subsection{psb\_cdbldext --- Build an extended communication
descriptor}
\begin{verbatim}
call psb_cdbldext(a,desc_a,nl,desc_out, info, extype)
\end{verbatim}
This subroutine builds an extended communication descriptor, based on
the input descriptor \verb|desc_a| and on the stencil specified
through the input sparse matrix \verb|a|.
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[a] A sparse matrix
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data type.
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data of type \spdata.
\item[nl] the number of additional layers desired.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer value $nl\ge 0$.
\item[extype] the kind of estension required.\\
Scope:{\bf global}.\\
Type:{\bf optional }.\\
Intent: {\bf in}.\\
Specified as: an integer value
\verb|psb_ovt_xhal_|, \verb|psb_ovt_asov_|, default: \verb|psb_ovt_xhal_|
\end{description}
\begin{description}
\item[\bf On Return]
\item[desc\_out] the extended communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \descdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item Specifying \verb|psb_ovt_xhal_| for the \verb|extype| argument
the user will obtain a descriptor for a domain partition in which
the additional layers are fetched as part of an (extended) halo;
however the index-to-process mapping is identical to that of the
base descriptor;
\item Specifying \verb|psb_ovt_asov_| for the \verb|extype| argument
the user will obtain a descriptor with an overlapped decomposition:
the additional layer is aggregated to the local subdomain (and thus
is an overlap), and a new halo extending beyond the last additional
layer is formed.
\end{enumerate}
%% %
%% %% psb_cdren %%
%% %
%% \subsection{psb\_cdren --- Applies a renumeration to a
%% communication descriptor}
%%% \addcontentsline{toc}{subsection}{psb\_cdren}
%% \syntax{call psb\_cdren}{trans, iperm, desc\_a, info}
%% \begin{description}
%% \item[\bf On Entry]
%% \item[Type:] Asynchronous.
%% \item[trans] A character that specifies whether to permute $A$ or $A^T$.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: a single character with value 'N' for $A$ or 'T' for $A^T$.\\
%% \item[iperm] An integer array containing permutation information.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: an integer one-dimensional array.\\
%% \item[desc\_a] the communication descriptor.\\
%% Scope:{\bf local}.\\
%% Type:{\bf required}.\\
%% Specified as: a structured data of type \descdata.
%% \end{description}
%% \begin{description}
%% \item[\bf On Return]
%% \item[info] Error code.
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: an integer variable.
%% \end{description}
%
%% psb_descprt %%
%
%% \subsection{psb\_cdprt --- Prints a descriptor}
%% \syntax{call psb\_cdprt}{iout, desc\_a, glob, short}
%% \begin{description}
%% \item[Type:] Asynchronous.
%% \item[\bf On Entry]
%% \item[iout] An integer that defines the output unit.
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: Integer scalar.\\
%% \item[desc\_a] The communication descriptor of type \descdata that
%% must be printed.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: a variable of type \descdata.\\
%% \end{description}
%% \begin{description}
%% \item[\bf On Return]
%% \item[glob] ??????
%% \item[short] ??????
%% \end{description}
%
%% psb_spalloc %%
%
\clearpage\subsection{psb\_spall --- Allocates a sparse matrix}
\begin{verbatim}
call psb_spall(a, desc_a, info [, nnz, dupl, bldmode])
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data of type \descdata.
\item[nnz] An estimate of the number of nonzeroes in the local
part of the assembled matrix.\\
Scope: {\bf global}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer value.
\item[dupl] How to handle duplicate coefficients.\\
Scope: {\bf global}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: integer, possible values: \verb|psb_dupl_ovwrt_|,
\verb|psb_dupl_add_|, \verb|psb_dupl_err_|.
\item[bldmode] Whether to keep track of matrix entries that do not
belong to the current process.\\
Scope: {\bf global}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an integer value \verb|psb_matbld_noremote_|,
\verb|psb_matbld_remote_|. Default: \verb|psb_matbld_noremote_|.
\end{description}
\begin{description}
\item[\bf On Return]
\item[a] the matrix to be allocated.\\
Scope:{\bf local}\\
Type:{\bf required}\\
Intent: {\bf out}.\\
Specified as: a structured data of type \spdata.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item On exit from this routine the sparse matrix is in the build
state.
\item The descriptor may be in either the build or assembled state.
\item Providing a good estimate for the number of nonzeroes $nnz$ in
the assembled matrix may substantially improve performance in the
matrix build phase, as it will reduce or eliminate the need for
(potentially multiple) data reallocations;
\item Using \verb|psb_matbld_remote_| is likely to cause a runtime overhead at
assembly time;
\end{enumerate}
%
%% psb_spins %%
%
\clearpage\subsection{psb\_spins --- Insert a set of coefficients into a sparse
matrix}
\begin{verbatim}
call psb_spins(nz, ia, ja, val, a, desc_a, info [,local])
call psb_spins(nr, irw, irp, ja, val, a, desc_a, info [,local])
\end{verbatim}
\begin{description}
\item[Type:] Asynchronous.
\item[\bf On Entry]
\item[nz] the number of coefficients to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer scalar.
\item[nr] the number of rows to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer scalar.
\item[irw] the first row to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer scalar.
\item[ia] the row indices of the coefficients to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer array of size $nz$.
\item[irp] the row pointers of the coefficients to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer array of size $nr+1$.
\item[ja] the column indices of the coefficients to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an integer array of size $nz$.
\item[val] the coefficients to be inserted.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: an array of size $nz$. Must be of the same type and kind
of the coefficients of the sparse matrix $a$.
\item[desc\_a] The communication descriptor.\\
Scope: {\bf local}. \\
Type: {\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a variable of type \descdata.\\
\item[local] Whether the entries in the indices vectors \verb|ia|,
\verb|ja| are already in local numbering. \\
Scope:{\bf local}.\\
Type:{\bf optional}.\\
Specified as: a logical value; default: \verb|.false.|.
%% \item[is] the starting row on matrix $a$.\\
%% Scope:{\bf local}.\\
%% Type:{\bf optional}.\\
%% Specified as: an integer vaule.
%% \item[js] the starting column on matrix $a$.\\
%% Scope:{\bf local}.\\
%% Type:{\bf optional}\\
%% Specified as: an integer value
\end{description}
\begin{description}
\item[\bf On Return]
\item[a] the matrix into which coefficients will be inserted.\\
Scope:{\bf local}\\
Type:{\bf required}\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \spdata.
\item[desc\_a] The communication descriptor.\\
Scope: {\bf local}. \\
Type: {\bf required}.\\
Intent: {\bf inout}.\\
Specified as: a variable of type \descdata.\\
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item On entry to this routine the descriptor may be in either the
build or assembled state.
\item On entry to this routine the sparse matrix may be in either the
build or update state.
\item If the descriptor is in the build state, then the sparse matrix
must also be in the build state; the action of the routine is to
(implicitly) call \verb|psb_cdins| to add entries to the sparsity
pattern; each sparse matrix entry implicitly defines a graph edge,
that is passed to the descriptor routine for the appropriate
processing;
\item The input data can be passed in either COO or CSR formats;
\item In COO format the coefficients to be inserted are represented by
the ordered triples $ia(i),ja(i),val(i)$, for $i=1,\dots,nz$;
these triples are arbitrary;
\item In CSR format the coefficients to be inserted for each input row $i=1,nr$
are represented by the ordered triples $(i+irw-1),ja(j),val(j)$, for
$j=irp(i),\dots,irp(i+1)-1$;
these triples should belong to the current process, i.e. $i+irw-1$
should be one of the local indices, but are otherwise arbitrary;
\item There is no requirement that a given row must be passed in its
entirety to a single call to this routine: the buildup of a row
may be split into as many calls as desired (even in the CSR format);
\item Coefficients from different rows may also be mixed up freely
in a single call, according to the application needs;
\item Coefficients from matrix rows not owned by the calling
process are treated according to the value of \verb|bldmode|
specified at allocation time; if
\verb|bldmode| was chosen as \verb|psb_matbld_remote_| the library
will keep track of them, otherwise they are silently ignored;
\item If the descriptor is in the assembled state, then any entries in
the sparse matrix that would generate additional communication
requirements are ignored;
\item If the matrix is in the update state, any entries in positions
that were not present in the original matrix are ignored.
\end{enumerate}
%
%% psb_spasb %%
%
\clearpage\subsection{psb\_spasb --- Sparse matrix assembly routine}
\begin{verbatim}
call psb_spasb(a, desc_a, info [, afmt, upd, mold])
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in/out}.\\
Specified as: a structured data of type \descdata.
\item[afmt] the storage format for the sparse matrix.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an array of characters. Defalt: 'CSR'.
\item[upd] Provide for updates to the matrix coefficients.\\
Scope: {\bf global}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: integer, possible values: \verb|psb_upd_srch_|, \verb|psb_upd_perm_|
\item[mold] The desired dynamic type for the internal matrix storage.\\
Scope: {\bf local}.\\
Type: {\bf optional}.\\
Intent: {\bf in}.\\
Specified as: an object of a class derived from \spbasedata.
\end{description}
\begin{description}
\item[\bf On Return]
\item[a] the matrix to be assembled.\\
Scope:{\bf local}\\
Type:{\bf required}\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \spdata.
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in/out}.\\
Specified as: a structured data of type \descdata. If the matrix was
allocated with \verb|bldmode=psb_matbld_remote_|, then the
descriptor will be reassembled.
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item On entry to this routine the descriptor must be in the
assembled state, i.e. \verb|psb_cdasb| must already have been called.
\item The sparse matrix may be in either the build or update state;
\item Duplicate entries are detected and handled in both build and
update state, with the exception of the error action that is only
taken in the build state, i.e. on the first assembly;
\item If the update choice is \verb|psb_upd_perm_|, then subsequent
calls to \verb|psb_spins| to update the matrix must be arranged in
such a way as to produce exactly the same sequence of coefficient
values as encountered at the first assembly;
\item The output storage format need not be the same on all
processes;
\item On exit from this routine the matrix is in the assembled state,
and thus is suitable for the computational routines;
\item If the \verb|bldmode=psb_matbld_remote_| value was specified
at allocation time, contributions defined on the current process but
belonging to a remote process will be handled accordingly. This is
most likely to occur in finite element applications, with
\verb|dupl=psb_dupl_add_|; it is necessary to check for possible
updates needed in the descriptor, hence there will be a runtime
overhead.
\end{enumerate}
%% %
%% %% psb_spcnv %%
%% %
%% \subsection{psb\_spcnv --- Converts a sparse matrix storage
%% format}
%% \syntax{call psb\_spcnv}{a, b, desc\_a, info}
%% \begin{description}
%% \item[\bf On Entry]
%% \item[a] the matrix to be converted.\\
%% Scope:{\bf local}\\
%% Type:{\bf required}\\
%% Specified as: a structured data of type \spdata.
%% \item[desc\_a] the communication descriptor.\\
%% Scope:{\bf local}.\\
%% Type:{\bf required}.\\
%% Specified as: a structured data of type \descdata.
%% \end{description}
%% \begin{description}
%% \item[\bf On Return]
%% \item[b] the converted matrix.\\
%% Scope:{\bf local}\\
%% Type:{\bf required}\\
%% Specified as: a structured data of type \spdata.
%% \item[info] Error code.
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: an integer variable.
%% \end{description}
%
%% psb_spfree %%
%
\clearpage\subsection{psb\_spfree --- Frees a sparse matrix}
\begin{verbatim}
call psb_spfree(a, desc_a, info)
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[a] the matrix to be freed.\\
Scope:{\bf local}\\
Type:{\bf required}\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \spdata.
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data of type \descdata.
\end{description}
\begin{description}
\item[\bf On Return]
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
%
%% psb_sprn %%
%
\clearpage\subsection{psb\_sprn --- Reinit sparse matrix structure for psblas
routines.}
\begin{verbatim}
call psb_sprn(a, decsc_a, info, clear)
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[a] the matrix to be reinitialized.\\
Scope:{\bf local}\\
Type:{\bf required}\\
Intent: {\bf inout}.\\
Specified as: a structured data of type \spdata.
\item[desc\_a] the communication descriptor.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Intent: {\bf in}.\\
Specified as: a structured data of type \descdata.
\item[clear] Choose whether to zero out matrix coefficients\\
Scope:{\bf local}.\\
Type:{\bf optional}.\\
Intent: {\bf in}.\\
Default: true.
\end{description}
\begin{description}
\item[\bf On Return]
\item[info] Error code.\\
Scope: {\bf local} \\
Type: {\bf required} \\
Intent: {\bf out}.\\
An integer value; 0 means no error has been detected.
\end{description}
{\par\noindent\large\bfseries Notes}
\begin{enumerate}
\item On exit from this routine the sparse matrix is in the update
state.
\end{enumerate}
%
%% psb_spupdate %%
%
%% \subsection{psb\_spupdate --- Updates a sparse matrix.}
%% \syntax{call psb\_spupdate}{a, ia, ja, blck, desc\_a, info, ix, jx, updflag}
%% \begin{description}
%% \item[\bf On Entry]
%% \end{description}
%% \begin{description}
%% \item[\bf On Return]
%% \end{description}
%% %
%% %% psb_csrp %%
%% %
%% \subsection{psb\_csrp --- Applies a right permutation to a sparse
%% matrix}
%% \syntax{call psb\_csrp}{trans, iperm, a, info}
%% \begin{description}
%% \item[\bf On Entry]
%% \item[trans] A character that specifies whether to permute $A$ or $A^T$.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: a single character with value 'N' for $A$ or 'T' for $A^T$.\\
%% \item[iperm] An integer array containing permutation information.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: an integer one-dimensional array.\\
%% \item[a] The sparse matrix to be permuted.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: a \spdata variable.\\
%% \begin{description}
%% \item[\bf On Return]
%% \item[info] Error code.\\
%% Scope: {\bf local} \\
%% Type: {\bf required}\\
%% Specified as: Integer scalar.\\
%% \end{description}
%
%% psb_alloc %%
%
\clearpage\subsection{psb\_geall --- Allocates a dense matrix}
%\addcontentsline{toc}{subsection}{psb\_geall}
\begin{verbatim}
call psb_geall(x, desc_a, info[, dupl, bldmode, n, lb])
\end{verbatim}
\begin{description}
\item[Type:] Synchronous.
\item[\bf On Entry]
\item[desc\_a] The communication descriptor.\\
Scope: {\bf local} \\
Type: {\bf required}\\
Intent: {\bf in}.\\
Specified as: a variable of type \descdata.\\
\item[n] The number of columns of the dense matrix to be allocated.\\
Scope: {\bf local} \\
Type: {\bf optional}\\
Intent: {\bf in}.\\
Specified as: Integer scalar, default $1$. It is not a valid argument if $x$ is a