-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpbits.f90
620 lines (573 loc) · 19.2 KB
/
mpbits.f90
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
!> \file
!! Bit field counters.
!!
!! \author Volker Blobel, University Hamburg, 2005-2009 (initial Fortran77 version)
!! \author Claus Kleinwort, DESY (maintenance and developement)
!!
!! \copyright
!! Copyright (c) 2009 - 2015 Deutsches Elektronen-Synchroton,
!! Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
!! This library is free software; you can redistribute it and/or modify
!! it under the terms of the GNU Library General Public License as
!! published by the Free Software Foundation; either version 2 of the
!! License, or (at your option) any later version. \n\n
!! This library is distributed in the hope that it will be useful,
!! but WITHOUT ANY WARRANTY; without even the implied warranty of
!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!! GNU Library General Public License for more details. \n\n
!! You should have received a copy of the GNU Library General Public
!! License along with this program (see the file COPYING.LIB for more
!! details); if not, write to the Free Software Foundation, Inc.,
!! 675 Mass Ave, Cambridge, MA 02139, USA.
!!
!! Count pairs of global parameters for sparse storage of global matrix,
!! apply pair entries cut and build (compressed) sparsity structure (row offsets, column lists).
!!
!! In sparse storage mode for each row the list of column indices with non zero elements
!! (and those elements) are stored. With compression this list is represented by the
!! first column and their number for continous regions (encoded in single INTEGER(mpi) words).
!! Rare elements may be stored in single precision.
!!
!> Bit field data.
MODULE mpbits
USE mpdef
IMPLICIT NONE
INTEGER(mpl) :: ndimb !< dimension for bit (field) array
INTEGER(mpi) :: n !< matrix size
INTEGER(mpi) :: ibfw !< bit field width
INTEGER(mpi) :: mxcnt !< max value for bit field counters
INTEGER(mpi) :: nencdm !< max value for column counter
INTEGER(mpi) :: nencdb !< number of bits for encoding column counter
INTEGER(mpi) :: nthrd !< number of threads
INTEGER(mpi), DIMENSION(:), ALLOCATABLE :: bitFieldCounters !< fit field counters for global parameters pairs
INTEGER(mpi), PARAMETER :: bs = BIT_SIZE(1_mpi) !< number of bits in INTEGER(mpi)
END MODULE mpbits
!> Fill bit fields (counters).
!!
!! \param [in] im first index
!! \param [in] jm second index
!! \param [in] inc increment (usually 1)
!!
SUBROUTINE inbits(im,jm,inc) ! include element (I,J)
USE mpbits
INTEGER(mpi), INTENT(IN) :: im
INTEGER(mpi), INTENT(IN) :: jm
INTEGER(mpi), INTENT(IN) :: inc
INTEGER(mpl) :: l
INTEGER(mpl) :: ll
INTEGER(mpi) :: i
INTEGER(mpi) :: j
INTEGER(mpi) :: noffj
INTEGER(mpi) :: m
INTEGER(mpi) :: mm
INTEGER(mpi) :: icount
INTEGER(mpi) :: ib
INTEGER(mpi) :: jcount
INTEGER(mpl) :: noffi
LOGICAL :: btest
IF(im == jm) RETURN ! diagonal
j=MIN(im,jm)
i=MAX(im,jm)
IF(j <= 0) RETURN ! out low
IF(i > n) RETURN ! out high
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(ibfw,mpl)/2 ! for J=1
noffj=(j-1)*ibfw
l=noffi/bs+i+noffj/bs ! row offset + column offset
! add I instead of 1 to keep bit maps of different rows in different words (openMP !)
m=MOD(noffj,bs)
IF (ibfw <= 1) THEN
bitFieldCounters(l)=ibset(bitFieldCounters(l),m)
ELSE
! get counter from bit field
ll=l
mm=m
icount=0
DO ib=0,ibfw-1
IF (btest(bitFieldCounters(ll),mm)) icount=ibset(icount,ib)
mm=mm+1
IF (mm >= bs) THEN
ll=ll+1
mm=mm-bs
END IF
END DO
! increment
jcount=icount
icount=MIN(icount+inc,mxcnt)
! store counter into bit field
IF (icount /= jcount) THEN
ll=l
mm=m
DO ib=0,ibfw-1
IF (btest(icount,ib)) THEN
bitFieldCounters(ll)=ibset(bitFieldCounters(ll),mm)
ELSE
bitFieldCounters(ll)=ibclr(bitFieldCounters(ll),mm)
END IF
mm=mm+1
IF (mm >= bs) THEN
ll=ll+1
mm=mm-bs
END IF
END DO
END IF
END IF
RETURN
END SUBROUTINE inbits
!> Calculate bit (field) array size, encoding.
!!
!! \param [in] in matrix size
!! \param [out] idimb dimension for bit (field) array
!! \param [out] iencdb number of bits for encoding column counter
!! \param [in] jbfw bit field width
!!
SUBROUTINE clbits(in,idimb,iencdb,jbfw)
USE mpbits
USE mpdalc
INTEGER(mpi), INTENT(IN) :: in
INTEGER(mpl), INTENT(OUT) :: idimb
INTEGER(mpi), INTENT(OUT) :: iencdb
INTEGER(mpi), INTENT(IN) :: jbfw
INTEGER(mpl) :: noffd
INTEGER(mpi) :: i
INTEGER(mpi) :: mb
INTEGER(mpi) :: nbcol
!$ INTEGER(mpi) :: OMP_GET_MAX_THREADS
n=in
ibfw=jbfw
mxcnt=2**ibfw-1
noffd=INT(n,mpl)*INT(n-1,mpl)*INT(ibfw,mpl)/2
ndimb=noffd/bs+n
idimb=ndimb
mb=INT(4.0E-6*REAL(ndimb,mps),mpi)
WRITE(*,*) ' '
WRITE(*,*) 'CLBITS: symmetric matrix of dimension',n
WRITE(*,*) 'CLBITS: off-diagonal elements',noffd
IF (mb > 0) THEN
WRITE(*,*) 'CLBITS: dimension of bit-array',ndimb , '(',mb,'MB)'
ELSE
WRITE(*,*) 'CLBITS: dimension of bit-array',ndimb , '(< 1 MB)'
END IF
CALL mpalloc(bitFieldCounters,ndimb,'INBITS: bit storage')
bitFieldCounters=0
! encoding for compression
nbcol=bs/2 ! one half of the bits for column number, other for column counter
DO i=bs/2,bs-2
IF (btest(n,i)) nbcol=i+1 ! more bits for column number
END DO
nencdb=bs-nbcol
iencdb=nencdb
nencdm=ishft(1,nencdb)-1
nthrd=1
!$ NTHRD=OMP_GET_MAX_THREADS()
RETURN
END SUBROUTINE clbits
!> Analyze bit fields.
!!
!! \param [out] ndims (1): (reduced) size of bit array; (2): size of column lists;
!! (3/4): number of (double/single precision) off diagonal elements;
!! \param[out] ncmprs compression info (per row)
!! \param[out] nsparr row offsets
!! \param[in] mnpair min. entries for pair
!! \param[in] ihst >0: histogram number
!! \param[in] jcmprs <>0: compress row information (column indices)
!!
SUBROUTINE ndbits(ndims,ncmprs,nsparr,mnpair,ihst,jcmprs)
USE mpbits
INTEGER(mpl), DIMENSION(4), INTENT(OUT) :: ndims
INTEGER(mpi), DIMENSION(:), INTENT(OUT) :: ncmprs
INTEGER(mpl), DIMENSION(:,:), INTENT(OUT) :: nsparr
INTEGER(mpi), INTENT(IN) :: mnpair
INTEGER(mpi), INTENT(IN) :: ihst
INTEGER(mpi), INTENT(IN) :: jcmprs
INTEGER(mpi) :: nwcp(0:1)
INTEGER(mpi) :: irgn(2)
INTEGER(mpi) :: inr(2)
INTEGER(mpi) :: ichunk
INTEGER(mpi) :: i
INTEGER(mpi) :: j
INTEGER(mpi) :: jb
INTEGER(mpi) :: m
INTEGER(mpi) :: last
INTEGER(mpi) :: lrgn
INTEGER(mpi) :: next
INTEGER(mpi) :: icp
INTEGER(mpi) :: kbfw
INTEGER(mpi) :: mm
INTEGER(mpi) :: jp
INTEGER(mpi) :: icmprs
INTEGER(mpi) :: nj
INTEGER(mpi) :: ib
INTEGER(mpi) :: ir
INTEGER(mpi) :: icount
INTEGER(mpi) :: iproc
INTEGER(mpi) :: jbfw
INTEGER(mpi) :: k
INTEGER(mpi) :: mb
INTEGER(mpi) :: n1
INTEGER(mpl) :: ll
INTEGER(mpl) :: lb
INTEGER(mpl) :: nin
INTEGER(mpl) :: ntot
INTEGER(mpl) :: noffi
REAL(mps) :: cpr
REAL(mps) :: fracu
REAL(mps) :: fracz
LOGICAL :: btest
!$ INTEGER(mpi) :: OMP_GET_THREAD_NUM
ndims(1)=ndimb
ndims(2)=0
ndims(3)=0
ndims(4)=0
ntot=0
icmprs=jcmprs
! reduce bit field counters to bits
kbfw=1
ll=0
lb=0
ichunk=MIN((n+nthrd-1)/nthrd/32+1,256)
IF (ibfw > 1.OR.icmprs /= 0) THEN
IF (ibfw > 1.AND.icmprs > 0) kbfw=2 ! need to tag single precision entries
jbfw=kbfw ! temp. bit field width
IF (nthrd > 1) jbfw=ibfw ! don't mix rows in bitFieldCounters
! parallelize row loop
! private copy of NDIMS,NTOT for each thread, combined at end, init with 0.
!$OMP PARALLEL DO &
!$OMP PRIVATE(I,LL,MM,LB,MB,INR,IRGN,LAST,LRGN, &
!$OMP J,ICOUNT,NEXT,IB,ICP,NWCP,JB,JP,IR) &
!$OMP REDUCTION(+:NDIMS,NTOT) &
!$OMP SCHEDULE(DYNAMIC,ICHUNK)
DO i=1,n
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(ibfw,mpl)/2
ll=noffi/bs+i
mm=0
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(jbfw,mpl)/2
lb=noffi/bs+i
mb=0
inr(1)=0
inr(2)=0
irgn(1)=0
irgn(2)=0
last=0
lrgn=0
iproc=0
!$ IPROC=OMP_GET_THREAD_NUM() ! thread number
DO j=1,i-1
icount=0
next=0
DO ib=0,ibfw-1
IF (btest(bitFieldCounters(ll),mm)) icount=ibset(icount,ib)
mm=mm+1
IF (mm >= bs) THEN
ll=ll+1
mm=mm-bs
END IF
END DO
DO jb=0,kbfw-1
bitFieldCounters(lb)=ibclr(bitFieldCounters(lb),mb+jb)
END DO
IF (icount > 0) THEN
ntot=ntot+1
IF (iproc == 0.AND.ihst > 0) CALL hmpent(ihst,REAL(icount,mps))
END IF
! keep pair ?
IF (icount >= mnpair) THEN
next=1 ! double
IF (icount < icmprs.AND.icmprs > 0) next=2 ! single
inr(next)=inr(next)+1
bitFieldCounters(lb)=ibset(bitFieldCounters(lb),mb+next-1)
IF (next /= last.OR.lrgn >= nencdm) THEN
irgn(next)=irgn(next)+1
lrgn=0
END IF
lrgn=lrgn+1
END IF
mb=mb+kbfw
IF (mb >= bs) THEN
lb=lb+1
mb=mb-bs
END IF
last=next
END DO
DO jp=1,kbfw
icp=0
nwcp(0)=inr(jp) ! list of column indices (default)
IF (inr(jp) > 0) THEN
nwcp(1)=irgn(jp)+(irgn(jp)+7)/8 ! list of regions of consecutive columns
! compress row ?
IF (nwcp(1) < nwcp(0).AND.icmprs /= 0) THEN
icp=1
ncmprs(i+n*(jp-1))=irgn(jp)
END IF
ndims(2) =ndims(2) +nwcp(icp)
ndims(jp+2)=ndims(jp+2)+nwcp(0)
END IF
ir=i+(n+1)*(jp-1)
nsparr(1,ir+1)=nwcp(icp)
nsparr(2,ir+1)=nwcp(0)
END DO
END DO
!$OMP END PARALLEL DO
! sum up, fill row offsets
lb=1
n1=0
ll=n+1
DO jp=1,kbfw
DO i=1,n
n1=n1+1
nsparr(1,n1)=lb
nsparr(2,n1)=ll
lb=lb+nsparr(1,n1+1)
ll=ll+nsparr(2,n1+1)
END DO
n1=n1+1
nsparr(1,n1)=lb
nsparr(2,n1)=ll
ll=1
END DO
IF (jbfw /= kbfw) THEN ! move bit fields
DO i=1,n
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(jbfw,mpl)/2
ll=noffi/bs+i
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(kbfw,mpl)/2
lb=noffi/bs+i
nj=((i-1)*kbfw)/bs
DO k=0,nj
bitFieldCounters(lb+k)=bitFieldCounters(ll+k)
END DO
END DO
END IF
ibfw=kbfw
noffi=INT(n,mpl)*INT(n-1,mpl)*INT(ibfw,mpl)/2
ndimb=noffi/bs+n
ndims(1)=ndimb
ELSE
nin=0
nsparr(1,1)=1
nsparr(2,1)=n+1
n1=1
DO i=1,n
noffi=INT(i-1,mpl)*INT(i-2,mpl)/2
ll=noffi/bs+i
nj=((i-1)*kbfw)/bs
DO k=0,nj
DO m=0,bs-1
IF(btest(bitFieldCounters(ll+k),m)) nin=nin+1
END DO
END DO
n1=n1+1
nsparr(1,n1)=nsparr(1,1)+nin
nsparr(2,n1)=nsparr(2,1)+nin
END DO
ndims(2)=nin
ndims(3)=nin
ntot=nin
END IF
nin=ndims(3)+ndims(4)
fracz=200.0*REAL(ntot,mps)/REAL(n,mps)/REAL(n-1,mps)
fracu=200.0*REAL(nin,mps)/REAL(n,mps)/REAL(n-1,mps)
WRITE(*,*) ' '
WRITE(*,*) 'NDBITS: number of diagonal elements',n
WRITE(*,*) 'NDBITS: number of used off-diagonal elements',nin
WRITE(*,1000) 'fraction of non-zero off-diagonal elements', fracz
WRITE(*,1000) 'fraction of used off-diagonal elements', fracu
IF (icmprs /= 0) THEN
cpr=100.0*REAL(mpi*ndims(2)+mpd*ndims(3)+mps*ndims(4),mps)/REAL((mpd+mpi)*nin,mps)
WRITE(*,1000) 'compression ratio for off-diagonal elements', cpr
END IF
1000 FORMAT(' NDBITS: ',a,f6.2,' %')
RETURN
END SUBROUTINE ndbits
!> Check sparsity of matrix.
!!
!! \param [out] ndims (1): (reduced) size of bit array; (2): size of column lists;
!! (3/4): number of (double/single precision) off diagonal elements;
!! \param[in] mnpair min. entries for pair
!! \param[in] jcmprs <>0: compress row information (column indices)
!!
SUBROUTINE ckbits(ndims,mnpair,jcmprs)
USE mpbits
INTEGER(mpl), DIMENSION(4), INTENT(OUT) :: ndims
INTEGER(mpi), INTENT(IN) :: mnpair
INTEGER(mpi), INTENT(IN) :: jcmprs
INTEGER(mpi) :: nwcp(0:1)
INTEGER(mpi) :: irgn(2)
INTEGER(mpi) :: inr(2)
INTEGER(mpl) :: ll
INTEGER(mpl) :: noffi
INTEGER(mpi) :: i
INTEGER(mpi) :: j
INTEGER(mpi) :: last
INTEGER(mpi) :: lrgn
INTEGER(mpi) :: next
INTEGER(mpi) :: icp
INTEGER(mpi) :: ib
INTEGER(mpi) :: icount
INTEGER(mpi) :: icmprs
INTEGER(mpi) :: kbfw
INTEGER(mpi) :: jp
INTEGER(mpi) :: mm
LOGICAL :: btest
DO i=1,4
ndims(i)=0
END DO
icmprs=jcmprs
kbfw=1
IF (ibfw > 1.AND.icmprs > 0) kbfw=2
ll=0
DO i=1,n
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(ibfw,mpl)/2
ll=noffi/bs+i
mm=0
inr(1)=0
inr(2)=0
irgn(1)=0
irgn(2)=0
last=0
lrgn=0
DO j=1,i-1
icount=0
next=0
DO ib=0,ibfw-1
IF (btest(bitFieldCounters(ll),mm)) icount=ibset(icount,ib)
mm=mm+1
IF (mm >= bs) THEN
ll=ll+1
mm=mm-bs
END IF
END DO
IF (icount > 0) ndims(1)=ndims(1)+1
! keep pair ?
IF (icount >= mnpair) THEN
next=1 ! double
IF (icount <= icmprs.AND.icmprs > 0) next=2 ! single
inr(next)=inr(next)+1
IF (next /= last.OR.lrgn >= nencdm) THEN
irgn(next)=irgn(next)+1
lrgn=0
END IF
lrgn=lrgn+1
END IF
last=next
END DO
IF (icmprs /= 0) THEN
DO jp=1,kbfw
IF (inr(jp) > 0) THEN
icp=0
nwcp(0)=inr(jp) ! list of column indices (default)
nwcp(1)=irgn(jp)+(irgn(jp)+7)/8 ! list of regions of consecutive columns
! compress row ?
IF (nwcp(1) < nwcp(0)) icp=1
ndims(2) =ndims(2) +nwcp(icp)
ndims(jp+2)=ndims(jp+2)+nwcp(0)
END IF
END DO
ELSE
ndims(2)=ndims(2)+inr(1)
ndims(3)=ndims(3)+inr(1)
END IF
END DO
RETURN
END SUBROUTINE ckbits
!> Create sparsity information.
!!
!! \param[in ] nsparr row offsets
!! \param[out] nsparc column indices
!! \param[in] ncmprs compression info (per row)
!!
SUBROUTINE spbits(nsparr,nsparc,ncmprs) ! collect elements
USE mpbits
USE mpdalc
INTEGER(mpl), DIMENSION(:,:), INTENT(IN) :: nsparr
INTEGER(mpi), DIMENSION(:), INTENT(OUT) :: nsparc
INTEGER(mpi), DIMENSION(:), INTENT(IN) :: ncmprs
INTEGER(mpl) :: kl
INTEGER(mpl) :: l
INTEGER(mpl) :: ll
INTEGER(mpl) :: l1
INTEGER(mpl) :: k8
INTEGER(mpl) :: n1
INTEGER(mpl) :: noffi
INTEGER(mpi) :: i
INTEGER(mpi) :: j
INTEGER(mpi) :: j1
INTEGER(mpi) :: jb
INTEGER(mpi) :: jn
INTEGER(mpi) :: m
INTEGER(mpi) :: ichunk
INTEGER(mpi) :: next
INTEGER(mpi) :: last
INTEGER(mpi) :: lrgn
INTEGER(mpi) :: nrgn
INTEGER(mpi) :: nrgn8
LOGICAL :: btest
ichunk=MIN((n+nthrd-1)/nthrd/32+1,256)
DO jb=0,ibfw-1
! parallelize row loop
!$OMP PARALLEL DO &
!$OMP PRIVATE(I,N1,NOFFI,L,M,KL,L1,NRGN,NRGN8,K8, &
!$OMP LAST,LRGN,LL,J1,JN,J,NEXT) &
!$OMP SCHEDULE(DYNAMIC,ICHUNK)
DO i=1,n
n1=i+jb*(n+1)
noffi=INT(i-1,mpl)*INT(i-2,mpl)*INT(ibfw,mpl)/2
l=noffi/bs+i
m=jb
kl=nsparr(1,n1)-1 ! pointer to row in NSPARC
l1=nsparr(2,n1) ! pointer to row in sparse matrix
nrgn=ncmprs(i+n*jb)! compression (number of consecutive regions)
nrgn8=(nrgn+7)/8 ! number of groups (1 offset per group)
k8=kl
kl=kl+nrgn8 ! reserve space of offsets
last=0
lrgn=0
ll=l1-1
j1=0
jn=0
DO j=1,i-1 ! loop for off-diagonal elements
next=0
IF(bitFieldCounters(l) /= 0) THEN
IF(btest(bitFieldCounters(l),m)) THEN
ll=ll+1
IF (nrgn <= 0) THEN
kl=kl+1
nsparc(kl)=j ! column index
ELSE
next=1
IF (last == 0.OR.jn >= nencdm) THEN
IF (MOD(lrgn,8) == 0) THEN
k8=k8+1
nsparc(k8)=INT(ll-l1,mpi)
END IF
lrgn=lrgn+1
kl=kl+1
j1=ishft(j,nencdb)
jn=0
END IF
jn=jn+1
nsparc(kl)=ior(j1,jn)
END IF
END IF
END IF
last=next
m=m+ibfw
IF (m >= bs) THEN
m=m-bs
l=l+1
END IF
END DO
END DO
!$OMP END PARALLEL DO
END DO
n1=(n+1)*ibfw
WRITE(*,*) ' '
WRITE(*,*) 'SPBITS: sparse structure constructed ',nsparr(1,n1), ' words'
WRITE(*,*) 'SPBITS: dimension parameter of matrix',nsparr(2,1)-1
IF (ibfw <= 1) THEN
WRITE(*,*) 'SPBITS: index of last used location',nsparr(2,n1)-1
ELSE
WRITE(*,*) 'SPBITS: index of last used double',nsparr(2,n1/2)-1
WRITE(*,*) 'SPBITS: index of last used single',nsparr(2,n1)-1
END IF
CALL mpdealloc(bitFieldCounters)
RETURN
END SUBROUTINE spbits