Generate and return the transpose of the input matrix of arbitrary type and kind using a cache-oblivious approach.
More...
Generate and return the transpose of the input matrix of arbitrary type and kind using a cache-oblivious approach.
In computing, a cache-oblivious (or cache-transcendent) algorithm is a method designed to take advantage of a processor cache without having the size of the cache (or the length of the cache lines, etc.) as an explicit parameter.
An optimal cache-oblivious algorithm is a cache-oblivious algorithm that uses the cache optimally.
Thus, a cache-oblivious algorithm is designed to perform well, without modification, on multiple machines with different cache sizes, or for a memory hierarchy with different levels of cache having different sizes.
Cache-oblivious algorithms are contrasted with explicit loop tiling, which explicitly breaks a problem into blocks that are optimally sized for a given cache.
Typically, a cache-oblivious algorithm works by a recursive divide-and-conquer algorithm, where the problem is divided into smaller and smaller subproblems.
Eventually, one reaches a subproblem size that fits into the cache, regardless of the cache size.
For example, an optimal cache-oblivious matrix multiplication is obtained by recursively dividing each matrix into four sub-matrices to be multiplied, multiplying the submatrices in a depth-first fashion.
In tuning for a specific machine, one may use a hybrid algorithm which uses loop tiling tuned for the specific cache sizes at the bottom level but otherwise uses the cache-oblivious algorithm.
- Parameters
-
[in,out] | source | : The input/output matrix (of rank 2 ) of either
-
type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) or,
-
type
integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) or,
-
type
logical of kind any supported by the processor (e.g., LK) or,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) or,
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) or,
whose contents will be Symmetric or Hermitian transposed.
-
If the output matrix argument
destin is missing, the result of transposition will be written to source .
This is possible only if the input source is a square matrix.
-
If the output matrix argument
destin is present, the result of transposition will be written to destin .
As such, the input source has intent(in) will not be modified by the algorithm.
|
[out] | destin | : The output matrix of the same type and kind, but transposed shape of source containing the transposition. (optional. If missing, the transposition result will be written to the input source , in which case, source must be square.) |
[in] | bsize | : The input positive scalar integer of default kind IK representing the minimum submatrix size.
Any input source or subset of it whose size along both dimensions is below bsize will be transposed via the default Fortran transpose() procedure.
(optional. default = 32 ) |
[in] | operation | : The input scalar that can be,
-
the constant transHerm exclusively when
source is of type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128). implying that a Hermitian transpose of the specified subset of source is to be computed and stored.
This argument is merely a convenience to differentiate the different procedure functionalities within this generic interface.
(optional. If missing, the Symmetric transposition will be returned for complex matrices.) |
Possible calling interfaces ⛓
call setMatTrans(source(
1:ndim,
1:ndim), operation, bsize)
call setMatTrans(source(
1:nrow,
1:ncol), destin(
1:ncol,
1:nrow))
call setMatTrans(source(
1:nrow,
1:ncol), destin(
1:ncol,
1:nrow), bsize)
call setMatTrans(source(
1:nrow,
1:ncol), destin(
1:ncol,
1:nrow), operation)
call setMatTrans(source(
1:nrow,
1:ncol), destin(
1:ncol,
1:nrow), operation, bsize)
Generate and return the transpose of the input matrix of arbitrary type and kind using a cache-oblivi...
This module contains abstract and concrete derived types and procedures related to various common mat...
type(transHerm_type), parameter transHerm
This is a scalar parameter object of type transHerm_type that is exclusively used to request Hermitia...
- Warning
- The condition
0 < bsize
must hold for the corresponding input arguments.
The condition size(source, 1) == size(source, 2)
must hold when the output argument destin
is missing.
The condition size(source, 1) == size(destin, 2) .and. size(source, 2) == size(destin, 1)
must hold for the corresponding input arguments.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- pm_matrixCopy
Example usage ⛓
11 type(display_type) :: disp
18 character(
2) :: matA(
5,
10), matB(
10,
5)
21 call disp%show(
"call setUnifRand(matA, 'AA', 'ZZ')")
24 call disp%show( matA , deliml
= SK_
"""" )
25 call disp%show(
"call setMatTrans(matA, matB)")
28 call disp%show( matB , deliml
= SK_
"""" )
37 character(
2) :: matA(
10,
10)
40 call disp%show(
"call setUnifRand(matA, 'AA', 'ZZ')")
43 call disp%show( matA , deliml
= SK_
"""" )
44 call disp%show(
"call setMatTrans(matA)")
47 call disp%show( matA , deliml
= SK_
"""" )
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
This module contains abstract and concrete derived types that are required for compile-time resolutio...
type(lowDia_type), parameter lowDia
This is a scalar parameter object of type lowDia_type that is exclusively used to request lower-diago...
type(uppLowDia_type), parameter uppLowDia
This is a scalar parameter object of type uppLowDia_type that is exclusively used to request full dia...
type(uppLow_type), parameter uppLow
This is a scalar parameter object of type uppLow_type that is exclusively used to request upper-lower...
type(uppDia_type), parameter uppDia
This is a scalar parameter object of type uppDia_type that is exclusively used to request upper-diago...
type(dia_type), parameter dia
This is a scalar parameter object of type dia_type that is exclusively used to request unit (or Ident...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
4"HK",
"GH",
"PS",
"LI",
"TR",
"HN",
"HT",
"WH",
"RI",
"DY"
5"EV",
"ZU",
"OS",
"HM",
"AB",
"IL",
"HO",
"OZ",
"LA",
"QJ"
6"JQ",
"HY",
"OB",
"AI",
"JP",
"AS",
"RP",
"YC",
"PN",
"UM"
7"CS",
"CS",
"BQ",
"CE",
"UM",
"QR",
"RF",
"IK",
"UW",
"JY"
8"MD",
"NW",
"HC",
"BA",
"OT",
"YG",
"RY",
"II",
"PD",
"MA"
11"HK",
"EV",
"JQ",
"CS",
"MD"
12"GH",
"ZU",
"HY",
"CS",
"NW"
13"PS",
"OS",
"OB",
"BQ",
"HC"
14"LI",
"HM",
"AI",
"CE",
"BA"
15"TR",
"AB",
"JP",
"UM",
"OT"
16"HN",
"IL",
"AS",
"QR",
"YG"
17"HT",
"HO",
"RP",
"RF",
"RY"
18"WH",
"OZ",
"YC",
"IK",
"II"
19"RI",
"LA",
"PN",
"UW",
"PD"
20"DY",
"QJ",
"UM",
"JY",
"MA"
25"QH",
"CU",
"EY",
"YM",
"BH",
"HK",
"DZ",
"DV",
"YV",
"ZY"
26"GI",
"RY",
"VY",
"XR",
"WU",
"JQ",
"AK",
"BP",
"AI",
"XR"
27"OB",
"OS",
"CT",
"ZV",
"LG",
"WY",
"OB",
"XJ",
"QR",
"EC"
28"YG",
"OG",
"ZX",
"WJ",
"YP",
"GQ",
"ZU",
"TF",
"HQ",
"UF"
29"DH",
"WQ",
"KY",
"IO",
"CB",
"TJ",
"MJ",
"GQ",
"MY",
"KF"
30"CY",
"XB",
"SH",
"NV",
"ST",
"JX",
"KO",
"WH",
"OA",
"LZ"
31"KF",
"YC",
"JG",
"FL",
"GY",
"LE",
"PL",
"ZR",
"JE",
"YI"
32"AS",
"IR",
"ZW",
"IQ",
"MG",
"XZ",
"XT",
"MW",
"EO",
"UO"
33"BA",
"FD",
"FL",
"LB",
"IV",
"MH",
"BS",
"HB",
"OK",
"XR"
34"YB",
"BO",
"IY",
"YR",
"NV",
"PP",
"WW",
"NR",
"VO",
"HX"
37"QH",
"GI",
"OB",
"YG",
"DH",
"CY",
"KF",
"AS",
"BA",
"YB"
38"CU",
"RY",
"OS",
"OG",
"WQ",
"XB",
"YC",
"IR",
"FD",
"BO"
39"EY",
"VY",
"CT",
"ZX",
"KY",
"SH",
"JG",
"ZW",
"FL",
"IY"
40"YM",
"XR",
"ZV",
"WJ",
"IO",
"NV",
"FL",
"IQ",
"LB",
"YR"
41"BH",
"WU",
"LG",
"YP",
"CB",
"ST",
"GY",
"MG",
"IV",
"NV"
42"HK",
"JQ",
"WY",
"GQ",
"TJ",
"JX",
"LE",
"XZ",
"MH",
"PP"
43"DZ",
"AK",
"OB",
"ZU",
"MJ",
"KO",
"PL",
"XT",
"BS",
"WW"
44"DV",
"BP",
"XJ",
"TF",
"GQ",
"WH",
"ZR",
"MW",
"HB",
"NR"
45"YV",
"AI",
"QR",
"HQ",
"MY",
"OA",
"JE",
"EO",
"OK",
"VO"
46"ZY",
"XR",
"EC",
"UF",
"KF",
"LZ",
"YI",
"UO",
"XR",
"HX"
- Benchmarks:
Benchmark :: The runtime performance of setMatTrans vs. Fortran intrinsic transpose()
. ⛓
5 use iso_fortran_env,
only:
error_unit
13 integer(IK) :: fileUnit
14 integer(IK) :: rank, irank
15 integer(IK) ,
parameter :: NRANK
= 20_IK
16 integer(IK) ,
parameter :: NBENCH
= 2_IK
17 real(RKG) :: dummySum
= 0._RKG
18 real(RKG) ,
allocatable :: matA(:,:)
20 real(RKG) ,
allocatable :: matB(:,:)
22 type(bench_type) :: bench(NBENCH)
25 bench(
2)
= bench_type(name
= SK_
"transpose", exec
= transpose , overhead
= setOverhead)
28 write(
*,
"(*(g0,:,' '))")
29 write(
*,
"(*(g0,:,' '))")
"setMatTrans() vs. transpose()"
30 write(
*,
"(*(g0,:,' '))")
32 open(newunit
= fileUnit, file
= "main.out", status
= "replace")
34 write(fileUnit,
"(*(g0,:,', '))")
"MatrixRank", (bench(i)
%name, i
= 1, NBENCH)
36 loopOverMatrixRank:
do irank
= 1, NRANK
43 write(
*,
"(*(g0,:,' '))")
"Benchmarking with rank", rank
46 bench(i)
%timing
= bench(i)
%getTiming(minsec
= 0.07_RK)
49 write(fileUnit,
"(*(g0,:,', '))") rank, (bench(i)
%timing
%mean, i
= 1, NBENCH)
54 end do loopOverMatrixRank
55 write(
*,
"(*(g0,:,' '))") dummySum
56 write(
*,
"(*(g0,:,' '))")
66 subroutine setOverhead()
72 dummySum
= dummySum
+ matB(
1,
1)
74 dummySum
= dummySum
+ matA(
1,
1)
90 subroutine transpose()
92 intrinsic :: transpose
94 matB
= transpose(matA)
96 matA
= transpose(matA)
Generate and return an object of type timing_type containing the benchmark timing information and sta...
This module contains abstract interfaces and types that facilitate benchmarking of different procedur...
This is the class for creating benchmark and performance-profiling objects.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Postprocessing of the benchmark output ⛓
3import matplotlib.pyplot
as plt
8dirname = os.path.basename(os.getcwd())
12df = pd.read_csv(
"main.out", delimiter =
", ")
13colnames = list(df.columns.values)
19ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
22for colname
in colnames[1:]:
23 plt.plot( df[colnames[0]].values
28plt.xticks(fontsize = fontsize)
29plt.yticks(fontsize = fontsize)
30ax.set_xlabel(colnames[0], fontsize = fontsize)
31ax.set_ylabel(
"Runtime [ seconds ]", fontsize = fontsize)
32ax.set_title(
" vs. ".join(colnames[1:])+
"\nLower is better.", fontsize = fontsize)
36plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
37ax.tick_params(axis =
"y", which =
"minor")
38ax.tick_params(axis =
"x", which =
"minor")
39ax.legend ( colnames[1:]
46plt.savefig(
"benchmark." + dirname +
".runtime.png")
52ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
55plt.plot( df[colnames[0]].values
56 , np.ones(len(df[colnames[0]].values))
61for colname
in colnames[2:]:
62 plt.plot( df[colnames[0]].values
63 , df[colname].values / df[colnames[1]].values
67plt.xticks(fontsize = fontsize)
68plt.yticks(fontsize = fontsize)
69ax.set_xlabel(colnames[0], fontsize = fontsize)
70ax.set_ylabel(
"Runtime compared to {}".format(colnames[1]), fontsize = fontsize)
71ax.set_title(
"Runtime Ratio Comparison. Lower means faster.\nLower than 1 means faster than {}().".format(colnames[1]), fontsize = fontsize)
75plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
76ax.tick_params(axis =
"y", which =
"minor")
77ax.tick_params(axis =
"x", which =
"minor")
78ax.legend ( colnames[1:]
85plt.savefig(
"benchmark." + dirname +
".runtime.ratio.png")
Visualization of the benchmark output ⛓
Benchmark moral ⛓
- The procedures under the generic interface setMatTrans use a cache-oblivious approach to matrix Symmetric transposition.
As such, they are particularly efficient and cache-friendly for large matrices.
As such, the generic interface setMatTrans can be significantly faster than the Fortran intrinsic transpose()
, depending on the Fortran compiler used.
This is particularly true for large-order matrices.
Benchmark :: The runtime performance of setMatTrans vs. Fortran intrinsic transpose()
. ⛓
4 use iso_fortran_env,
only:
error_unit
12 integer(IK) :: fileUnit
13 integer(IK) :: rank, irank
14 integer(IK) ,
parameter :: NRANK
= 20_IK
15 integer(IK) ,
parameter :: NBENCH
= 2_IK
16 complex(RKG) :: dummySum
= 0._RKG
17 complex(RKG),
allocatable :: matA(:,:)
18 type(bench_type) :: bench(NBENCH)
20 bench(
1)
= bench_type(name
= SK_
"setMatTrans(transHerm)", exec
= setMatTrans , overhead
= setOverhead)
21 bench(
2)
= bench_type(name
= SK_
"transpose(conjg())", exec
= transpose , overhead
= setOverhead)
24 write(
*,
"(*(g0,:,' '))")
25 write(
*,
"(*(g0,:,' '))")
"setMatTrans() vs. transpose(conjg())"
26 write(
*,
"(*(g0,:,' '))")
28 open(newunit
= fileUnit, file
= "main.out", status
= "replace")
30 write(fileUnit,
"(*(g0,:,', '))")
"MatrixRank", (bench(i)
%name, i
= 1, NBENCH)
32 loopOverMatrixRank:
do irank
= 1, NRANK
35 allocate(matA(rank, rank))
36 write(
*,
"(*(g0,:,' '))")
"Benchmarking with rank", rank
40 bench(i)
%timing
= bench(i)
%getTiming(minsec
= 0.07_RK)
43 write(fileUnit,
"(*(g0,:,', '))") rank, (bench(i)
%timing
%mean, i
= 1, NBENCH)
46 end do loopOverMatrixRank
47 write(
*,
"(*(g0,:,' '))") dummySum
48 write(
*,
"(*(g0,:,' '))")
58 subroutine setOverhead()
63 dummySum
= dummySum
+ matA(
1,
1)
66 subroutine setMatTrans()
74 subroutine transpose()
76 intrinsic :: transpose
77 matA
= transpose(
conjg(matA))
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Postprocessing of the benchmark output ⛓
3import matplotlib.pyplot
as plt
8dirname = os.path.basename(os.getcwd())
12df = pd.read_csv(
"main.out", delimiter =
", ")
13colnames = list(df.columns.values)
19ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
22for colname
in colnames[1:]:
23 plt.plot( df[colnames[0]].values
28plt.xticks(fontsize = fontsize)
29plt.yticks(fontsize = fontsize)
30ax.set_xlabel(colnames[0], fontsize = fontsize)
31ax.set_ylabel(
"Runtime [ seconds ]", fontsize = fontsize)
32ax.set_title(
" vs. ".join(colnames[1:])+
"\nLower is better.", fontsize = fontsize)
36plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
37ax.tick_params(axis =
"y", which =
"minor")
38ax.tick_params(axis =
"x", which =
"minor")
39ax.legend ( colnames[1:]
46plt.savefig(
"benchmark." + dirname +
".runtime.png")
52ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
55plt.plot( df[colnames[0]].values
56 , np.ones(len(df[colnames[0]].values))
61for colname
in colnames[2:]:
62 plt.plot( df[colnames[0]].values
63 , df[colname].values / df[colnames[1]].values
67plt.xticks(fontsize = fontsize)
68plt.yticks(fontsize = fontsize)
69ax.set_xlabel(colnames[0], fontsize = fontsize)
70ax.set_ylabel(
"Runtime compared to {}".format(colnames[1]), fontsize = fontsize)
71ax.set_title(
"Runtime Ratio Comparison. Lower means faster.\nLower than 1 means faster than {}().".format(colnames[1]), fontsize = fontsize)
75plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
76ax.tick_params(axis =
"y", which =
"minor")
77ax.tick_params(axis =
"x", which =
"minor")
78ax.legend ( colnames[1:]
85plt.savefig(
"benchmark." + dirname +
".runtime.ratio.png")
Visualization of the benchmark output ⛓
Benchmark moral ⛓
- The procedures under the generic interface setMatTrans use a cache-oblivious approach to matrix Hermitian transposition.
As such, they are particularly efficient and cache-friendly for large matrices.
As such, the generic interface setMatTrans can be significantly faster than the Fortran intrinsic transpose()
, depending on the Fortran compiler used.
This is particularly true for large-order matrices.
Benchmark :: The runtime performance of setMatTrans vs. Fortran intrinsic transpose()
. ⛓
5 use iso_fortran_env,
only:
error_unit
17 integer(IK) :: fileUnit
20 integer(IK) ,
parameter :: RANK
= 1000_IK
21 real(RKG) :: dummySum
= 0._RKG
22 integer(IK) ,
allocatable :: BlockSize(:)
23 type(bench_type),
allocatable :: bench(:)
24 real(RKG) ,
allocatable :: matA(:,:)
26 real(RKG) ,
allocatable :: matB(:,:)
27 allocate(matB(RANK, RANK))
30 allocate(matA(RANK, RANK))
33 bench
= [
bench_type(name
= getReplaced(SK_
"setMatTrans(matA(RANK,RANK))", SK_
"RANK",
getStr(RANK)), exec
= setMatTrans, overhead
= setOverhead)
&
34 ,
bench_type(name
= getReplaced( SK_
"transpose(matA(RANK,RANK))", SK_
"RANK",
getStr(RANK)), exec
= transpose, overhead
= setOverhead)
&
39 write(
*,
"(*(g0,:,' '))")
40 write(
*,
"(*(g0,:,' '))")
"setMatTransBlock"
41 write(
*,
"(*(g0,:,' '))")
43 open(newunit
= fileUnit, file
= "main.out", status
= "replace")
45 write(fileUnit,
"(*(g0,:,', '))")
"BlockSize", (bench(i)
%name, i
= 1,
size(bench))
47 loopOverMatrixRank:
do iblock
= 1,
size(BlockSize)
49 bsize
= BlockSize(iblock)
50 write(
*,
"(*(g0,:,' '))")
"Benchmarking with block size", bsize
53 bench(i)
%timing
= bench(i)
%getTiming(minsec
= 0.07_RK)
56 write(fileUnit,
"(*(g0,:,', '))") bsize, (bench(i)
%timing
%mean, i
= 1,
size(bench))
58 end do loopOverMatrixRank
62 write(
*,
"(*(g0,:,' '))") dummySum
63 write(
*,
"(*(g0,:,' '))")
71 subroutine setOverhead()
77 dummySum
= dummySum
+ matB(
1,
1)
79 dummySum
= dummySum
+ matA(
1,
1)
83 subroutine setMatTrans()
95 subroutine transpose()
97 intrinsic :: transpose
99 matB
= transpose(matA)
101 matA
= transpose(matA)
Generate and return an arrayNew of the same type and kind as the input array, in which the requested ...
Generate count evenly-logarithmically-spaced points over the interval [base**logx1,...
Generate and return a vector of unique values in the input array.
Generate and return the conversion of the input value to an output Fortran string,...
This module contains procedures and generic interfaces for replacing patterns within arrays of variou...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains procedures and generic interfaces for finding unique values of an input array of...
This module contains the generic procedures for converting values of different types and kinds to For...
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Postprocessing of the benchmark output ⛓
3import matplotlib.pyplot
as plt
8dirname = os.path.basename(os.getcwd())
12df = pd.read_csv(
"main.out", delimiter =
", ")
13colnames = list(df.columns.values)
19ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
22for colname
in colnames[1:]:
23 plt.plot( df[colnames[0]].values
28plt.xticks(fontsize = fontsize)
29plt.yticks(fontsize = fontsize)
30ax.set_xlabel(colnames[0], fontsize = fontsize)
31ax.set_ylabel(
"Runtime [ seconds ]", fontsize = fontsize)
32ax.set_title(
" vs. ".join(colnames[1:])+
"\nLower is better.", fontsize = fontsize)
36plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
37ax.tick_params(axis =
"y", which =
"minor")
38ax.tick_params(axis =
"x", which =
"minor")
39ax.legend ( colnames[1:]
46plt.savefig(
"benchmark." + dirname +
".runtime.png")
52ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
55plt.plot( df[colnames[0]].values
56 , np.ones(len(df[colnames[0]].values))
61for colname
in colnames[2:]:
62 plt.plot( df[colnames[0]].values
63 , df[colname].values / df[colnames[1]].values
67plt.xticks(fontsize = fontsize)
68plt.yticks(fontsize = fontsize)
69ax.set_xlabel(colnames[0], fontsize = fontsize)
70ax.set_ylabel(
"Runtime compared to {}".format(colnames[1]), fontsize = fontsize)
71ax.set_title(
"Runtime Ratio Comparison. Lower means faster.\nLower than 1 means faster than {}().".format(colnames[1]), fontsize = fontsize)
75plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
76ax.tick_params(axis =
"y", which =
"minor")
77ax.tick_params(axis =
"x", which =
"minor")
78ax.legend ( colnames[1:]
85plt.savefig(
"benchmark." + dirname +
".runtime.ratio.png")
Visualization of the benchmark output ⛓
Benchmark moral ⛓
- The procedures under the generic interface setMatTrans use a cache-oblivious approach to matrix Hermitian transposition.
As such, they are particularly efficient and cache-friendly for large matrices.
However, despite its name and goals, the cache-oblivious algorithm is not entirely independent of the cache size (and hence the minimum block size) as evidenced here.
- Test:
- test_pm_matrixTrans
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Todo:
- Normal Priority: The performance of this algorithm could be possibly improved by converting the recursive procedure calls within the implementation to do-loops.
- Author:
- Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin
Definition at line 767 of file pm_matrixTrans.F90.