| 1 |
/*! \file DissectionMatrix.hpp |
| 2 |
\brief management of threads for factorization and Fw/Bw substitution |
| 3 |
\author Atsushi Suzuki, Laboratoire Jacques-Louis Lions |
| 4 |
\date Jun. 20th 2014 |
| 5 |
\date Jul. 12th 2015 |
| 6 |
\date Nov. 30th 2016 |
| 7 |
*/ |
| 8 |
|
| 9 |
// This file is part of Dissection |
| 10 |
// |
| 11 |
// Dissection is free software: you can redistribute it and/or modify |
| 12 |
// it under the terms of the GNU General Public License as published by |
| 13 |
// the Free Software Foundation, either version 3 of the License, or |
| 14 |
// (at your option) any later version. |
| 15 |
// |
| 16 |
// Linking Dissection statically or dynamically with other modules is making |
| 17 |
// a combined work based on Disssection. Thus, the terms and conditions of |
| 18 |
// the GNU General Public License cover the whole combination. |
| 19 |
// |
| 20 |
// As a special exception, the copyright holders of Dissection give you |
| 21 |
// permission to combine Dissection program with free software programs or |
| 22 |
// libraries that are released under the GNU LGPL and with independent modules |
| 23 |
// that communicate with Dissection solely through the Dissection-fortran |
| 24 |
// interface. You may copy and distribute such a system following the terms of |
| 25 |
// the GNU GPL for Dissection and the licenses of the other code concerned, |
| 26 |
// provided that you include the source code of that other code when and as |
| 27 |
// the GNU GPL requires distribution of source code and provided that you do |
| 28 |
// not modify the Dissection-fortran interface. |
| 29 |
// |
| 30 |
// Note that people who make modified versions of Dissection are not obligated |
| 31 |
// to grant this special exception for their modified versions; it is their |
| 32 |
// choice whether to do so. The GNU General Public License gives permission to |
| 33 |
// release a modified version without this exception; this exception also makes |
| 34 |
// it possible to release a modified version which carries forward this |
| 35 |
// exception. If you modify the Dissection-fortran interface, this exception |
| 36 |
// does not apply to your modified version of Dissection, and you must remove |
| 37 |
// this exception when you distribute your modified version. |
| 38 |
// |
| 39 |
// This exception is an additional permission under section 7 of the GNU |
| 40 |
// General Public License, version 3 ("GPLv3") |
| 41 |
// |
| 42 |
// Dissection is distributed in the hope that it will be useful, |
| 43 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 44 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 45 |
// GNU General Public License for more details. |
| 46 |
// |
| 47 |
// You should have received a copy of the GNU General Public License |
| 48 |
// along with Dissection. If not, see <http://www.gnu.org/licenses/>. |
| 49 |
// |
| 50 |
|
| 51 |
#include "Compiler/OptionLibrary.hpp" |
| 52 |
#include <string> |
| 53 |
#include "Driver/DissectionMatrix.hpp" |
| 54 |
#include "Algebra/SparseRenumbering.hpp" |
| 55 |
|
| 56 |
// to_stirng is available in C++11 but NEC SXC++ does not support it |
| 57 |
#include "Compiler/DissectionIO.hpp" |
| 58 |
|
| 59 |
template<typename T, typename U> |
| 60 |
DissectionMatrix<T, U>::DissectionMatrix(Dissection::Tree *btree, |
| 61 |
const int nb, |
| 62 |
bool isSym, |
| 63 |
const bool verbose, |
| 64 |
FILE *fp) : |
| 65 |
_nb(nb), _diag(NULL), _lower(NULL), _upper(NULL), _isSym(isSym) |
| 66 |
{ |
| 67 |
const int level_last = btree->NumberOfLevels() - 1; |
| 68 |
_level = btree->nodeLayer(_nb); |
| 69 |
_nrow = btree->sizeOfDomain(_nb); |
| 70 |
_ncol_offdiag = btree->sizeOfFathersStrips(_nb); |
| 71 |
if (_nrow == 0) { |
| 72 |
_ncol_offdiag = 0; // for safety |
| 73 |
} |
| 74 |
// no need to be allocated through the whole process |
| 75 |
// |
| 76 |
// _loc2glob_diag = btree->getDiagLoc2Glob(_nb); |
| 77 |
// _loc2glob_offdiag = btree->getOffdiagLoc2Glob(_nb); |
| 78 |
|
| 79 |
_csr_diag = &(btree->getDiagCSR(_nb)); |
| 80 |
_csr_offdiag = &(btree->getOffdiagCSR(_nb)); |
| 81 |
_upper = new RectBlockMatrix<T>; |
| 82 |
_lower = new RectBlockMatrix<T>; |
| 83 |
// for unsymmetric matrix _lower block is stored in transposed way to use |
| 84 |
// the same strips as _upper block |
| 85 |
// bool later_allocation |
| 86 |
_localSchur = new SquareBlockMatrix<T>; |
| 87 |
|
| 88 |
if (_level == level_last) { |
| 89 |
_islast = true; |
| 90 |
_color_mask = new int[_nrow]; |
| 91 |
_colors = getColorMaskCSR(_color_mask, _csr_diag, verbose, fp); |
| 92 |
_tridiag = new TridiagBlockMatrix<T,U>*[_colors]; |
| 93 |
for (int i = 0; i < _colors; i++) { |
| 94 |
_tridiag[i] = new TridiagBlockMatrix<T,U>(_nrow, SIZE_B1, _isSym, nb, |
| 95 |
verbose, fp); |
| 96 |
} |
| 97 |
// the value of the last pivot and singluar nodes to be stored in _diag |
| 98 |
_diag = new SquareBlockMatrix<T>; |
| 99 |
_upper->init(_nrow, _ncol_offdiag, SIZE_B1, 0); |
| 100 |
_upper->allocate(); |
| 101 |
_lower->init(_nrow, _ncol_offdiag, SIZE_B1, 0); |
| 102 |
if (!_isSym) { |
| 103 |
_lower->allocate(); |
| 104 |
} |
| 105 |
_localSchur->init(_ncol_offdiag, SIZE_B1, _isSym, 0); // 02 Feb.2014 |
| 106 |
_alignedFather = false; |
| 107 |
} |
| 108 |
else { |
| 109 |
_islast = false; |
| 110 |
if (_nrow > 0) { |
| 111 |
_diag = new SquareBlockMatrix<T>(_nrow, SIZE_B1, _isSym); |
| 112 |
} |
| 113 |
else { |
| 114 |
_diag = new SquareBlockMatrix<T>(); // dummy |
| 115 |
} |
| 116 |
_tridiag = (TridiagBlockMatrix<T, U> **)NULL; |
| 117 |
if (_nb > 1) { |
| 118 |
int ntmp = 0; |
| 119 |
if (_nrow > 0) { |
| 120 |
const int b_id = btree->brotherIndex(_nb); |
| 121 |
const int ll = _level - 1; |
| 122 |
const Dissection::SetOfStrips& f0 = btree->getFathersStrips(_nb)[ll]; |
| 123 |
const Dissection::SetOfStrips& f1 = btree->getFathersStrips(b_id)[ll]; |
| 124 |
_alignedFather = false; |
| 125 |
if ((btree->sizeOfDomain(b_id) > 0) && |
| 126 |
(f0.numberOfStrips() == 1) && (f1.numberOfStrips() == 1)) { |
| 127 |
Dissection::SetOfStrips::const_iterator it0 = f0.begin(); |
| 128 |
Dissection::SetOfStrips::const_iterator it1 = f1.begin(); |
| 129 |
if (((*it0).begin_src == (*it1).begin_src) && |
| 130 |
((*it0).width == (*it1).width)) { |
| 131 |
_alignedFather = true; |
| 132 |
ntmp = f0.numberOfIndices(); |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
else { |
| 137 |
_alignedFather = false; // the other brother is treaed as nonaligned |
| 138 |
} |
| 139 |
if (!_alignedFather) { |
| 140 |
diss_printf(verbose, fp, "%s %d : %d : %s\n", __FILE__, __LINE__, |
| 141 |
_nb, (_alignedFather ? "aligned" : "nonaligned")); |
| 142 |
} |
| 143 |
_upper->init(_nrow, _ncol_offdiag, SIZE_B1, ntmp); |
| 144 |
_upper->allocate(); |
| 145 |
_lower->init(_nrow, _ncol_offdiag, SIZE_B1, ntmp); |
| 146 |
if (!_isSym) { |
| 147 |
_lower->allocate(); |
| 148 |
} |
| 149 |
_localSchur->init(_ncol_offdiag, SIZE_B1, _isSym, ntmp); // 02 Feb.2014 |
| 150 |
} |
| 151 |
} |
| 152 |
// pointer to working array which is allocated and deallocated in |
| 153 |
// C_dfull_sym_gauss_b() |
| 154 |
_factorize_LDLt = new ColumnMatrix<T>; //new T*; |
| 155 |
// _factorize_LDLt_diag = new ColumnMatrix<T>; // new T*; |
| 156 |
diss_printf(verbose, fp, |
| 157 |
"%s %d : %d : nrow : %d : %d = %d + %d num_blocks : %d = %d + %d\n", |
| 158 |
__FILE__, |
| 159 |
__LINE__, |
| 160 |
_nb, |
| 161 |
_nrow, |
| 162 |
_ncol_offdiag, |
| 163 |
_localSchur->dimension0(), |
| 164 |
_localSchur->dimension1(), |
| 165 |
_localSchur->num_blocks(), |
| 166 |
_localSchur->num_blocks0(), |
| 167 |
_localSchur->num_blocks1()); |
| 168 |
} |
| 169 |
|
| 170 |
template |
| 171 |
DissectionMatrix<double>:: |
| 172 |
DissectionMatrix(Dissection::Tree *btree, |
| 173 |
const int nb, |
| 174 |
const bool isSym, |
| 175 |
const bool verbose, |
| 176 |
FILE *fp); |
| 177 |
|
| 178 |
template |
| 179 |
DissectionMatrix<complex<double>, double>:: |
| 180 |
DissectionMatrix(Dissection::Tree *btree, |
| 181 |
const int nb, |
| 182 |
const bool isSym, |
| 183 |
const bool verbose, |
| 184 |
FILE *fp); |
| 185 |
|
| 186 |
template |
| 187 |
DissectionMatrix<quadruple>:: |
| 188 |
DissectionMatrix(Dissection::Tree *btree, |
| 189 |
const int nb, |
| 190 |
const bool isSym, |
| 191 |
const bool verbose, |
| 192 |
FILE *fp); |
| 193 |
|
| 194 |
template |
| 195 |
DissectionMatrix<complex<quadruple>, quadruple>:: |
| 196 |
DissectionMatrix(Dissection::Tree *btree, |
| 197 |
const int nb, |
| 198 |
const bool isSym, |
| 199 |
const bool verbose, |
| 200 |
FILE *fp); |
| 201 |
|
| 202 |
template |
| 203 |
DissectionMatrix<float>:: |
| 204 |
DissectionMatrix(Dissection::Tree *btree, |
| 205 |
const int nb, |
| 206 |
const bool isSym, |
| 207 |
const bool verbose, |
| 208 |
FILE *fp); |
| 209 |
|
| 210 |
template |
| 211 |
DissectionMatrix<complex<float>, float>:: |
| 212 |
DissectionMatrix(Dissection::Tree *btree, |
| 213 |
const int nb, |
| 214 |
const bool isSym, |
| 215 |
const bool verbose, |
| 216 |
FILE *fp); |
| 217 |
// |
| 218 |
|
| 219 |
template<typename T, typename U> |
| 220 |
void DissectionMatrix<T, U>::C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 221 |
Dissection::Tree *btree, |
| 222 |
const bool verbose, |
| 223 |
FILE **fp) |
| 224 |
{ |
| 225 |
string task_name = "sparse_s_fact : " + to_string(_nb); |
| 226 |
long opsl = _csr_diag->n; // since factarization is based on skyline |
| 227 |
// complexity is a linear function of size |
| 228 |
C_SparseSymbFact_arg<T, U> *arg = |
| 229 |
new C_SparseSymbFact_arg<T, U>(_tridiag, |
| 230 |
_colors, |
| 231 |
_color_mask, |
| 232 |
btree->sizeOfDomain(_nb), |
| 233 |
_csr_diag, |
| 234 |
verbose, |
| 235 |
fp); |
| 236 |
// |
| 237 |
*(arg->nopd) = opsl; // very rough estimate, will be updated after run |
| 238 |
*(arg->ops_complexity) = opsl; |
| 239 |
|
| 240 |
queue[0] = new C_task(C_SPARSESYMBFACT, |
| 241 |
task_name, |
| 242 |
(void *)arg, |
| 243 |
C_SparseSymbFact<T, U>, |
| 244 |
1, // atomic_size |
| 245 |
0, // atomic_id |
| 246 |
arg->ops_complexity // ops_complexity |
| 247 |
); |
| 248 |
} |
| 249 |
|
| 250 |
template |
| 251 |
void DissectionMatrix<double>:: |
| 252 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 253 |
Dissection::Tree *btree, |
| 254 |
const bool verbose, |
| 255 |
FILE **fp); |
| 256 |
|
| 257 |
template |
| 258 |
void DissectionMatrix<complex<double>, double>:: |
| 259 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 260 |
Dissection::Tree *btree, |
| 261 |
const bool verbose, |
| 262 |
FILE **fp); |
| 263 |
|
| 264 |
template |
| 265 |
void DissectionMatrix<quadruple>:: |
| 266 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 267 |
Dissection::Tree *btree, |
| 268 |
const bool verbose, |
| 269 |
FILE **fp); |
| 270 |
|
| 271 |
template |
| 272 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 273 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 274 |
Dissection::Tree *btree, |
| 275 |
const bool verbose, |
| 276 |
FILE **fp); |
| 277 |
|
| 278 |
template |
| 279 |
void DissectionMatrix<float>:: |
| 280 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 281 |
Dissection::Tree *btree, |
| 282 |
const bool verbose, |
| 283 |
FILE **fp); |
| 284 |
|
| 285 |
template |
| 286 |
void DissectionMatrix<complex<float>, float>:: |
| 287 |
C_SparseSymbFact_queue(vector<C_task*>& queue, |
| 288 |
Dissection::Tree *btree, |
| 289 |
const bool verbose, |
| 290 |
FILE **fp); |
| 291 |
|
| 292 |
// |
| 293 |
|
| 294 |
template<typename T, typename U> |
| 295 |
void DissectionMatrix<T, U>::C_SparseNumFact_queue(vector<C_task*>& queue, |
| 296 |
Dissection::Tree *btree, |
| 297 |
int nnz, |
| 298 |
T *coefs, |
| 299 |
double *eps_pivot, |
| 300 |
double *pivot, |
| 301 |
bool *kernel_detection, |
| 302 |
bool *higher_precision, |
| 303 |
int *aug_dim, |
| 304 |
U *eps_machine, |
| 305 |
vector<C_task*>& task_q, |
| 306 |
const bool verbose, |
| 307 |
FILE **fp) |
| 308 |
{ |
| 309 |
string task_name = "n : " + to_string(_nb); |
| 310 |
|
| 311 |
// char *task_name_cstr = new char[task_name.str().size() + 1]; |
| 312 |
// strcpy(task_name_cstr, task_name.str().c_str()); |
| 313 |
|
| 314 |
// complexity is a linear function of size |
| 315 |
const int nrow = btree->sizeOfDomain(_nb); |
| 316 |
const int ncol = btree->sizeOfFathersStrips(_nb); |
| 317 |
C_SparseNumFact_arg<T, U> *arg = |
| 318 |
new C_SparseNumFact_arg<T, U>(_tridiag, //_num_Sys, |
| 319 |
_isSym, |
| 320 |
_colors, |
| 321 |
_color_mask, |
| 322 |
nnz, //ptDA->nz(), // nnz |
| 323 |
coefs, //ptDA->getCoef(), // *coefs |
| 324 |
nrow, |
| 325 |
ncol, |
| 326 |
_csr_diag, |
| 327 |
_csr_offdiag, |
| 328 |
_diag, |
| 329 |
eps_pivot, |
| 330 |
pivot, |
| 331 |
kernel_detection, |
| 332 |
higher_precision, |
| 333 |
aug_dim, |
| 334 |
eps_machine, |
| 335 |
_localSchur, |
| 336 |
verbose, |
| 337 |
fp, |
| 338 |
_nb); |
| 339 |
const long ncoll = ncol; |
| 340 |
const long nrowl = nrow; |
| 341 |
*(arg->nopd) = ncoll * ncoll * nrowl; // very rough estimate , |
| 342 |
// will be updated after run |
| 343 |
queue[0] = new C_task(C_SPARSENUMFACT, |
| 344 |
task_name, |
| 345 |
(void *)arg, |
| 346 |
C_SparseNumFact<T, U>, |
| 347 |
1, // atomic_size |
| 348 |
0, // atomic_id |
| 349 |
((C_SparseSymbFact_arg<T, U> *)(task_q[0]->func_arg))->nopd); |
| 350 |
} |
| 351 |
|
| 352 |
template |
| 353 |
void DissectionMatrix<double>:: |
| 354 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 355 |
Dissection::Tree *btree, |
| 356 |
int nnz, |
| 357 |
double *coefs, |
| 358 |
double *eps_pivot, |
| 359 |
double *pivot, |
| 360 |
bool *kernel_detection, |
| 361 |
bool *higher_precision, |
| 362 |
int *aug_dim, |
| 363 |
double *eps_machine, |
| 364 |
vector<C_task*>& task_q, |
| 365 |
const bool verbose, |
| 366 |
FILE **fp); |
| 367 |
|
| 368 |
template |
| 369 |
void DissectionMatrix<complex<double>, double>:: |
| 370 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 371 |
Dissection::Tree *btree, |
| 372 |
int nnz, |
| 373 |
complex<double> *coefs, |
| 374 |
double *eps_pivot, |
| 375 |
double *pivot, |
| 376 |
bool *kernel_detection, |
| 377 |
bool *higher_precision, |
| 378 |
int *aug_dim, |
| 379 |
double *eps_machine, |
| 380 |
vector<C_task*>& task_q, |
| 381 |
const bool verbose, |
| 382 |
FILE **fp); |
| 383 |
|
| 384 |
template |
| 385 |
void DissectionMatrix<quadruple>:: |
| 386 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 387 |
Dissection::Tree *btree, |
| 388 |
int nnz, |
| 389 |
quadruple *coefs, |
| 390 |
double *eps_pivot, |
| 391 |
double *pivot, |
| 392 |
bool *kernel_detection, |
| 393 |
bool *higher_precision, |
| 394 |
int *aug_dim, |
| 395 |
quadruple *eps_machine, |
| 396 |
vector<C_task*>& task_q, |
| 397 |
const bool verbose, |
| 398 |
FILE **fp); |
| 399 |
|
| 400 |
template |
| 401 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 402 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 403 |
Dissection::Tree *btree, |
| 404 |
int nnz, |
| 405 |
complex<quadruple> *coefs, |
| 406 |
double *eps_pivot, |
| 407 |
double *pivot, |
| 408 |
bool *kernel_detection, |
| 409 |
bool *higher_precision, |
| 410 |
int *aug_dim, |
| 411 |
quadruple *eps_machine, |
| 412 |
vector<C_task*>& task_q, |
| 413 |
const bool verbose, |
| 414 |
FILE **fp); |
| 415 |
|
| 416 |
template |
| 417 |
void DissectionMatrix<float>:: |
| 418 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 419 |
Dissection::Tree *btree, |
| 420 |
int nnz, |
| 421 |
float *coefs, |
| 422 |
double *eps_pivot, |
| 423 |
double *pivot, |
| 424 |
bool *kernel_detection, |
| 425 |
bool *higher_precision, |
| 426 |
int *aug_dim, |
| 427 |
float *eps_machine, |
| 428 |
vector<C_task*>& task_q, |
| 429 |
const bool verbose, |
| 430 |
FILE **fp); |
| 431 |
|
| 432 |
template |
| 433 |
void DissectionMatrix<complex<float>, float>:: |
| 434 |
C_SparseNumFact_queue(vector<C_task*>& queue, |
| 435 |
Dissection::Tree *btree, |
| 436 |
int nnz, |
| 437 |
complex<float> *coefs, |
| 438 |
double *eps_pivot, |
| 439 |
double *pivot, |
| 440 |
bool *kernel_detection, |
| 441 |
bool *higher_precision, |
| 442 |
int *aug_dim, |
| 443 |
float *eps_machine, |
| 444 |
vector<C_task*>& task_q, |
| 445 |
const bool verbose, |
| 446 |
FILE **fp); |
| 447 |
// |
| 448 |
|
| 449 |
template<typename T, typename U> |
| 450 |
void DissectionMatrix<T, U>::C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 451 |
Dissection::Tree *btree, |
| 452 |
int nnz, |
| 453 |
T *coefs, |
| 454 |
vector<C_task*>& task_p, |
| 455 |
const bool verbose, |
| 456 |
FILE **fp) |
| 457 |
{ |
| 458 |
string task_name = "o : " + to_string(_nb); |
| 459 |
// char *task_name_cstr = new char[task_name.str().size() + 1]; |
| 460 |
// strcpy(task_name_cstr, task_name.str().c_str()); |
| 461 |
|
| 462 |
// complexity is a linear function of size |
| 463 |
C_SparseNumFact_arg<T, U> *arg = |
| 464 |
new C_SparseNumFact_arg<T, U>(_tridiag, |
| 465 |
_isSym, |
| 466 |
_colors, |
| 467 |
_color_mask, |
| 468 |
nnz, // ptDA->nz(), // nnz |
| 469 |
coefs, // ptDA->getCoef(), // *coefs |
| 470 |
btree->sizeOfDomain(_nb), |
| 471 |
btree->sizeOfFathersStrips(_nb), |
| 472 |
_csr_diag, |
| 473 |
_csr_offdiag, |
| 474 |
_diag, |
| 475 |
(double *)NULL, // eps_pivot |
| 476 |
(double *)NULL, // pivot |
| 477 |
(bool *)NULL, // kernel detection dummy |
| 478 |
(bool *)NULL, // higher preicision dummy |
| 479 |
(int *)NULL, // dummy |
| 480 |
(U *)NULL, // dummy |
| 481 |
_localSchur, |
| 482 |
verbose, |
| 483 |
fp, |
| 484 |
_nb); |
| 485 |
|
| 486 |
queue[0] = new C_task(C_SPARSESCHUR, |
| 487 |
task_name, |
| 488 |
(void *)arg, |
| 489 |
C_SparseLocalSchur<T, U>, |
| 490 |
1, // atomic_size |
| 491 |
0, // atomic_id |
| 492 |
((C_SparseNumFact_arg<T, U> *)(task_p[0]->func_arg))->nopd |
| 493 |
); |
| 494 |
queue[0]->fp = &(arg->fp); |
| 495 |
queue[0]->parents->push_back(task_p[0]); |
| 496 |
} |
| 497 |
|
| 498 |
template |
| 499 |
void DissectionMatrix<double>:: |
| 500 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 501 |
Dissection::Tree *btree, |
| 502 |
int nnz, |
| 503 |
double *coefs, |
| 504 |
vector<C_task*>& task_p, |
| 505 |
const bool verbose, |
| 506 |
FILE **fp); |
| 507 |
|
| 508 |
template |
| 509 |
void DissectionMatrix<complex<double>, double>:: |
| 510 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 511 |
Dissection::Tree *btree, |
| 512 |
int nnz, |
| 513 |
complex<double> *coefs, |
| 514 |
vector<C_task*>& task_p, |
| 515 |
const bool verbose, |
| 516 |
FILE **fp); |
| 517 |
|
| 518 |
template |
| 519 |
void DissectionMatrix<quadruple>:: |
| 520 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 521 |
Dissection::Tree *btree, |
| 522 |
int nnz, |
| 523 |
quadruple *coefs, |
| 524 |
vector<C_task*>& task_p, |
| 525 |
const bool verbose, |
| 526 |
FILE **fp); |
| 527 |
|
| 528 |
template |
| 529 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 530 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 531 |
Dissection::Tree *btree, |
| 532 |
int nnz, |
| 533 |
complex<quadruple> *coefs, |
| 534 |
vector<C_task*>& task_p, |
| 535 |
const bool verbose, |
| 536 |
FILE **fp); |
| 537 |
|
| 538 |
template |
| 539 |
void DissectionMatrix<float>:: |
| 540 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 541 |
Dissection::Tree *btree, |
| 542 |
int nnz, |
| 543 |
float *coefs, |
| 544 |
vector<C_task*>& task_p, |
| 545 |
const bool verbose, |
| 546 |
FILE **fp); |
| 547 |
|
| 548 |
template |
| 549 |
void DissectionMatrix<complex<float>, float>:: |
| 550 |
C_SparseLocalSchur_queue(vector<C_task*>& queue, |
| 551 |
Dissection::Tree *btree, |
| 552 |
int nnz, |
| 553 |
complex<float> *coefs, |
| 554 |
vector<C_task*>& task_p, |
| 555 |
const bool verbose, |
| 556 |
FILE **fp); |
| 557 |
|
| 558 |
// |
| 559 |
|
| 560 |
template<typename T, typename U> |
| 561 |
void DissectionMatrix<T, U>::C_FillMatrix_queue(vector<C_task*>& queue, |
| 562 |
int nnz, |
| 563 |
T *coefs, |
| 564 |
const bool verbose, |
| 565 |
FILE **fp) |
| 566 |
{ |
| 567 |
{ |
| 568 |
string task_name = "l : " + to_string(_nb); |
| 569 |
// 16 Sep.2014 : Atsushi |
| 570 |
// -1L is used for initialization of the array <=> dependecy |
| 571 |
long ops; |
| 572 |
if (_level > 0) { |
| 573 |
// replace -1L by 1L : 29 Nov.2016 Atsushi |
| 574 |
// ops = _csr_offdiag->nnz == 0 ? (-1L) : (long)_csr_offdiag->nnz; |
| 575 |
ops = _csr_offdiag->nnz == 0 ? 1L : (long)_csr_offdiag->nnz; |
| 576 |
} |
| 577 |
else { |
| 578 |
ops = 0L; |
| 579 |
} |
| 580 |
// if (ops > 0) need to be skippid : 29 Aug.2014 Atsushi |
| 581 |
C_FillMatrix_arg<T> *arg = |
| 582 |
new C_FillMatrix_arg<T>(_isSym, |
| 583 |
(SquareBlockMatrix<T>*)NULL, |
| 584 |
_upper, |
| 585 |
(_isSym ? (RectBlockMatrix<T>*)NULL : _lower), |
| 586 |
(CSR_indirect*)NULL, |
| 587 |
_csr_offdiag, |
| 588 |
coefs, |
| 589 |
verbose, |
| 590 |
fp, |
| 591 |
_nb); |
| 592 |
*(arg->ops_complexity) = ops; |
| 593 |
|
| 594 |
queue[1] = new C_task(C_FILLMATRIX, |
| 595 |
task_name, |
| 596 |
(void *)arg, |
| 597 |
C_FillMatrix_offdiag<T>, |
| 598 |
1, // atomic_size |
| 599 |
0, // atomic_id |
| 600 |
arg->ops_complexity // ops_complexity |
| 601 |
); |
| 602 |
} |
| 603 |
{ // begin scope : task_name |
| 604 |
|
| 605 |
string task_name = "k : " + to_string(_nb); |
| 606 |
|
| 607 |
long ops = (long)(_csr_diag->nnz + _csr_diag->n) / 2L; |
| 608 |
C_FillMatrix_arg<T> *arg = |
| 609 |
new C_FillMatrix_arg<T>(_isSym, |
| 610 |
_diag, |
| 611 |
(RectBlockMatrix<T>*)NULL, // upper |
| 612 |
(RectBlockMatrix<T>*)NULL, // lower |
| 613 |
_csr_diag, |
| 614 |
(CSR_indirect*)NULL, |
| 615 |
coefs, |
| 616 |
verbose, |
| 617 |
fp, |
| 618 |
_nb); |
| 619 |
// ptDA->getCoef()); |
| 620 |
*(arg->ops_complexity) = ops; |
| 621 |
|
| 622 |
queue[0] = new C_task(C_FILLMATRIX, |
| 623 |
task_name, |
| 624 |
(void *)arg, |
| 625 |
C_FillMatrix_diag<T>, |
| 626 |
1, // atomic_size |
| 627 |
0, // atomic_id |
| 628 |
arg->ops_complexity // ops_complexity |
| 629 |
); |
| 630 |
} |
| 631 |
} |
| 632 |
|
| 633 |
template |
| 634 |
void DissectionMatrix<double>:: |
| 635 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 636 |
int nnz, |
| 637 |
double *coefs, |
| 638 |
const bool verbose, |
| 639 |
FILE **fp); |
| 640 |
|
| 641 |
template |
| 642 |
void DissectionMatrix<complex<double>, double>:: |
| 643 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 644 |
int nnz, |
| 645 |
complex<double> *coefs, |
| 646 |
const bool verbose, |
| 647 |
FILE **fp); |
| 648 |
|
| 649 |
template |
| 650 |
void DissectionMatrix<quadruple>:: |
| 651 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 652 |
int nnz, |
| 653 |
quadruple *coefs, |
| 654 |
const bool verbose, |
| 655 |
FILE **fp); |
| 656 |
|
| 657 |
template |
| 658 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 659 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 660 |
int nnz, |
| 661 |
complex<quadruple> *coefs, |
| 662 |
const bool verbose, |
| 663 |
FILE **fp); |
| 664 |
|
| 665 |
template |
| 666 |
void DissectionMatrix<float>:: |
| 667 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 668 |
int nnz, |
| 669 |
float *coefs, |
| 670 |
const bool verbose, |
| 671 |
FILE **fp); |
| 672 |
|
| 673 |
template |
| 674 |
void DissectionMatrix<complex<float>, float>:: |
| 675 |
C_FillMatrix_queue(vector<C_task*>& queue, |
| 676 |
int nnz, |
| 677 |
complex<float> *coefs, |
| 678 |
const bool verbose, |
| 679 |
FILE **fp); |
| 680 |
// |
| 681 |
|
| 682 |
template<typename T, typename U> |
| 683 |
int DissectionMatrix<T, U>::C_DFullLDLt_queue(vector<C_task*>& queue, |
| 684 |
vector<int>& task_indcol, |
| 685 |
vector<int>& task_ptr, |
| 686 |
double *eps_piv, |
| 687 |
bool *kernel_detection, |
| 688 |
int *aug_dim, |
| 689 |
U *eps_machine, |
| 690 |
double *pivot, |
| 691 |
double *pivot0, |
| 692 |
double *pivot1, |
| 693 |
vector<C_task*>& task_p, |
| 694 |
const bool isChldrnAlgnd, |
| 695 |
const bool verbose, |
| 696 |
FILE **fp) |
| 697 |
{ |
| 698 |
const int n = _diag->dimension(); // _nrow |
| 699 |
const int upper_ncol = getUpperNCol(); // _ncol_offdiag |
| 700 |
|
| 701 |
const int num_block = _diag->num_blocks(); |
| 702 |
int num_tasks1; |
| 703 |
int ipos, jpos; |
| 704 |
int parent_id; |
| 705 |
|
| 706 |
if (_level == 0) { |
| 707 |
num_tasks1 = ((num_block - 1) * num_block * (num_block + 1) / 6 + |
| 708 |
num_block); |
| 709 |
} |
| 710 |
else { |
| 711 |
num_tasks1 = 0; |
| 712 |
} |
| 713 |
|
| 714 |
if (n == 0) { |
| 715 |
queue.resize(1); |
| 716 |
string task_name = ("a dummy : " + |
| 717 |
to_string(_level) + " : " +to_string(_nb)); |
| 718 |
C_dummy_arg *arg = new C_dummy_arg(verbose, fp, _nb); |
| 719 |
// *(arg->ops_complexity) = (-1L); |
| 720 |
queue[0] = new C_task(C_DUMMY, |
| 721 |
task_name, |
| 722 |
(void *)arg, |
| 723 |
C_dummy, |
| 724 |
1, // atomic_size, |
| 725 |
0, // atomic_id, |
| 726 |
arg->ops_complexity); |
| 727 |
queue[0]->parents->clear(); |
| 728 |
task_ptr.clear(); |
| 729 |
return 1; |
| 730 |
} |
| 731 |
int atomic_size, atomic_id; |
| 732 |
// int *ptr; |
| 733 |
if (_level == 0) { |
| 734 |
task_ptr.resize(2 * num_block + 1); |
| 735 |
// ptr = new int[2 * num_block + 1]; |
| 736 |
} |
| 737 |
else { |
| 738 |
task_ptr.resize(num_block + 1); |
| 739 |
} |
| 740 |
#ifdef DEBUG_MUTEX_C_DFULLLDLT |
| 741 |
cout << "**** C_DFullLDLt " |
| 742 |
<< " starts with " << n << " sized-matrix by " << SIZE_B1 |
| 743 |
<< " ****" << endl; |
| 744 |
#endif |
| 745 |
// keeping starting index of triangular factorizations at k-th level |
| 746 |
task_ptr[0] = 0; |
| 747 |
for (int k = 0; k < num_block; k++) { |
| 748 |
task_ptr[k + 1] = task_ptr[k] + ((num_block - k) * (num_block - k + 1)) / 2; |
| 749 |
} |
| 750 |
if (_level == 0) { |
| 751 |
int kk = num_block; |
| 752 |
for (int k = 0; k < num_block; k++, kk++) { |
| 753 |
task_ptr[kk + 1] = (task_ptr[kk] + |
| 754 |
((num_block - k - 1) * (num_block - k)) / 2 + 1); |
| 755 |
} |
| 756 |
} |
| 757 |
#ifdef DEBUG_C_DFULLLDLT |
| 758 |
cout << "group_id = " << group_id << " : "; |
| 759 |
for (int k = 0; k < num_block + 1; k++) { |
| 760 |
cout << task_ptr[k] << " "; |
| 761 |
} |
| 762 |
cout << endl; |
| 763 |
#endif |
| 764 |
// queue with "blocked" pivot strategy |
| 765 |
// generating tasks |
| 766 |
// a^0, {b^0_0, c^0_00, a^1}, b^0_1,....,b^0_m, c^0_01,c^0_11,...,c^0_mm, |
| 767 |
// {b^1_0,c^1_00 a^2}, b^1_1,....,b^1_{m-1}, c^0_01,...,c^0_{m-1}{m-1}, |
| 768 |
ipos = (-1); |
| 769 |
// |
| 770 |
jpos = 0; |
| 771 |
for (int k = 0; k < num_block; k++) { |
| 772 |
const int nrow = _diag->nrowBlock(k); |
| 773 |
int task_position; |
| 774 |
task_position = 0; |
| 775 |
|
| 776 |
if (k == 0) { |
| 777 |
task_position = 1; |
| 778 |
} |
| 779 |
if (k == (num_block - 1)) { |
| 780 |
task_position += 2; |
| 781 |
} |
| 782 |
|
| 783 |
// task a^k |
| 784 |
{ // scope for char *task_name_cstr |
| 785 |
if (k == 0) { |
| 786 |
ipos = 0; |
| 787 |
atomic_size = 1; |
| 788 |
atomic_id = 0; |
| 789 |
} |
| 790 |
else { |
| 791 |
ipos = task_ptr[k - 1] + 3; |
| 792 |
atomic_size = 3; |
| 793 |
atomic_id = 2; |
| 794 |
} |
| 795 |
string task_name = ("a " + to_string(k) + " : " + to_string(_level) + |
| 796 |
" : " + to_string(_nb)); |
| 797 |
const long nrowl = (long)nrow; |
| 798 |
const long ops = nrowl * (nrowl + 1L) * (nrowl + 2L) + nrowl; |
| 799 |
C_dfull_gauss_arg<T, U> *arg = |
| 800 |
new C_dfull_gauss_arg<T, U>(_isSym, |
| 801 |
task_position, // int task_position |
| 802 |
_level, |
| 803 |
num_block, |
| 804 |
k, |
| 805 |
_diag, |
| 806 |
_localSchur, |
| 807 |
_factorize_LDLt, // pointer for T[n * n] |
| 808 |
// _factorize_LDLt_diag, // diag |
| 809 |
(int *)NULL, // int *permute_block |
| 810 |
n, // int n |
| 811 |
upper_ncol, // lower matrix size |
| 812 |
nrow, // int nrow |
| 813 |
k, // int i1 |
| 814 |
eps_piv, |
| 815 |
pivot, |
| 816 |
pivot0, |
| 817 |
pivot1, |
| 818 |
kernel_detection, |
| 819 |
aug_dim, |
| 820 |
eps_machine, |
| 821 |
verbose, |
| 822 |
fp, |
| 823 |
_nb); |
| 824 |
*(arg->ops_complexity) = ops; |
| 825 |
queue[ipos] = new C_task(C_DFULL_SYM_GAUSS, |
| 826 |
task_name, |
| 827 |
(void *)arg, |
| 828 |
C_dfull_gauss_b<T, U>, |
| 829 |
atomic_size, |
| 830 |
atomic_id, |
| 831 |
arg->ops_complexity // ops_complexity |
| 832 |
); |
| 833 |
arg->quit = &queue[ipos]->quit_queue; |
| 834 |
queue[ipos]->fp = &(arg->fp); |
| 835 |
task_indcol[jpos++] = ipos; |
| 836 |
if (k == 0) { |
| 837 |
// a^0 is the root |
| 838 |
queue[ipos]->parallel_max = 1; |
| 839 |
queue[ipos]->parallel_id = 0; |
| 840 |
// depndency on dgemm/dsub of previous factorization level |
| 841 |
queue[ipos]->parents->push_back(task_p[0]); |
| 842 |
} |
| 843 |
else { |
| 844 |
queue[ipos]->parallel_max = (-1); |
| 845 |
queue[ipos]->parallel_id = 0; |
| 846 |
// no need to write dependency : sequential operation inside of atom |
| 847 |
// resolves dependency |
| 848 |
// parent_id = task_ptr[k - 1] + 2; // c^{k-1}_{0,0} |
| 849 |
// queue[ipos]->parents->push_back(queue[parent_id]); |
| 850 |
} |
| 851 |
if (task_position / 2 == 1) { |
| 852 |
queue[ipos]->to_next_task = num_tasks1; |
| 853 |
} |
| 854 |
} // scope for char *task_namefp_cstr |
| 855 |
for (int j = 0; j < (num_block - 1 - k); j++) { |
| 856 |
const int jj = k + j + 1; |
| 857 |
// task b^k_j |
| 858 |
{ // scope for char *task_name_cstr |
| 859 |
// lower part stored in transposed |
| 860 |
const int ncol = _diag->ncolBlock(jj, k); |
| 861 |
if (j == 0) { |
| 862 |
// a^{k}, b^{k}_0 |
| 863 |
ipos = task_ptr[k] + 1; |
| 864 |
atomic_size = 3; |
| 865 |
atomic_id = 0; |
| 866 |
} |
| 867 |
else { |
| 868 |
// a^{k}, b^{k}_0 c^{k}_00 a^{k+1}, b^{k}_1, ... |
| 869 |
// three tasks a^{k} c^{k}_00 a^{k+1} prior {b^{k}} |
| 870 |
ipos = task_ptr[k] + j + 3; |
| 871 |
atomic_size = 1; |
| 872 |
atomic_id = 0; |
| 873 |
} |
| 874 |
string task_name = ("b " + to_string(k) + " " + to_string(j) |
| 875 |
+ " : " + to_string(_level) + " : " |
| 876 |
+ to_string(_nb)); |
| 877 |
const long nrowl = (long)nrow; |
| 878 |
const long ncoll = (long)ncol; |
| 879 |
const long ops = (nrowl - 1L) * nrowl * ncoll + nrowl * ncoll; |
| 880 |
// dtrsm for (nrow x ncol matrix) + D^-1 (nrow x ncol matrix) |
| 881 |
C_dinvDL_timesU_arg<T> *arg = |
| 882 |
new C_dinvDL_timesU_arg<T>(_isSym, |
| 883 |
task_position, |
| 884 |
_level, |
| 885 |
num_block, |
| 886 |
k, |
| 887 |
_diag, //D, |
| 888 |
_factorize_LDLt, |
| 889 |
n, // int n |
| 890 |
nrow, // int nrow |
| 891 |
ncol, // int ncol |
| 892 |
k, // int i1 |
| 893 |
jj, // k + j + 1, |
| 894 |
verbose, |
| 895 |
fp, |
| 896 |
_nb); |
| 897 |
*(arg->ops_complexity) = ops; |
| 898 |
queue[ipos] = new C_task(C_DINV_DL_TIMESU, |
| 899 |
task_name, |
| 900 |
(void *)arg, |
| 901 |
C_dinvDL_timesU<T>, |
| 902 |
atomic_size, |
| 903 |
atomic_id, |
| 904 |
arg->ops_complexity // ops_complexity |
| 905 |
); |
| 906 |
task_indcol[jpos++] = ipos; |
| 907 |
queue[ipos]->parallel_max = (num_block - k - 1); |
| 908 |
queue[ipos]->parallel_id = j; |
| 909 |
|
| 910 |
if (k == 0) { |
| 911 |
// depndency on dgemm/dsub of previous factorization level |
| 912 |
if (_isSym || !isChldrnAlgnd) { |
| 913 |
const int jtmp = ((j + 1) * (j + 2)) / 2; |
| 914 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 915 |
} |
| 916 |
else { |
| 917 |
const int jtmp = (j + 1) * (j + 1); |
| 918 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 919 |
queue[ipos]->parents->push_back(task_p[jtmp + 1]); |
| 920 |
} |
| 921 |
parent_id = task_ptr[k]; // a^0 |
| 922 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 923 |
} |
| 924 |
else { |
| 925 |
parent_id = task_ptr[k - 1] + 3; // a^k |
| 926 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 927 |
// c^{k-1}_{0,j+1} |
| 928 |
parent_id = (task_ptr[k - 1] + (num_block - k + 2) + |
| 929 |
((j + 1) * (j + 2)) / 2); |
| 930 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 931 |
} // if (k == 0) |
| 932 |
} // scope for char *task_name_cstr : task b^k_j |
| 933 |
} |
| 934 |
for (int j = 0; j < (num_block - 1 - k); j++) { |
| 935 |
const int jj = k + j + 1; |
| 936 |
const int ncol = _diag->ncolBlock(jj, k); |
| 937 |
for (int i = 0; i < j; i++) { |
| 938 |
// task c^k_{i,j} |
| 939 |
{ |
| 940 |
ipos = (task_ptr[k] + |
| 941 |
2 + // a^0 a^1 |
| 942 |
(num_block - k - 1) + // b^0_0 ,... b^0_{num_blok-k-2} |
| 943 |
(j * (j + 1)) / 2 + // size of upper triangle |
| 944 |
i); // |
| 945 |
string task_name = ("c " + to_string(k) + " " + to_string(i) |
| 946 |
+ " " + to_string(j) + " : " + to_string(_level) |
| 947 |
+ " : " + to_string(_nb)); |
| 948 |
const long nrowl = (long)nrow; |
| 949 |
const long ncoll = (long)ncol; |
| 950 |
const long ops = nrowl * nrowl * ncoll * 2L; |
| 951 |
// optimized BLAS3 gemm : opt. factor = 1/0.5 |
| 952 |
C_dupdateb_Schur_arg<T> *arg = |
| 953 |
new C_dupdateb_Schur_arg<T>(_isSym, |
| 954 |
task_position, |
| 955 |
_level, |
| 956 |
num_block, |
| 957 |
k, |
| 958 |
_diag, //D, |
| 959 |
_factorize_LDLt, |
| 960 |
// _factorize_LDLt_work, |
| 961 |
n, |
| 962 |
nrow, |
| 963 |
ncol, |
| 964 |
SIZE_B1, |
| 965 |
k, // i1 |
| 966 |
k + i + 1, |
| 967 |
jj, // k + j + 1, |
| 968 |
verbose, |
| 969 |
fp, |
| 970 |
_nb); |
| 971 |
*(arg->ops_complexity) = ops; |
| 972 |
queue[ipos] = new C_task(C_DHALF_SCHUR_B, |
| 973 |
task_name, |
| 974 |
// task_name_cstr, |
| 975 |
(void *)arg, |
| 976 |
C_dupdateb_Schur_offdiag<T>, |
| 977 |
1, // atomic_size |
| 978 |
0, // atomic_id |
| 979 |
arg->ops_complexity // ops_complexity |
| 980 |
); |
| 981 |
task_indcol[jpos++] = ipos; |
| 982 |
// |
| 983 |
// c^k_00 is computed with b^k_0 and a^{k+1} |
| 984 |
queue[ipos]->parallel_max = ((num_block - k - 1) * |
| 985 |
(num_block - k)) / 2 - 1; |
| 986 |
queue[ipos]->parallel_id = (j * (j + 1)) / 2 + i - 1 ; |
| 987 |
if (k == 0) { |
| 988 |
// depndency on dgemm/dsub of previous factorization level |
| 989 |
// (i + 1)-th row, (j + 1)-th column |
| 990 |
if (_isSym || !isChldrnAlgnd) { |
| 991 |
const int jtmp = ((j + 1) * (j + 2)) / 2 + i + 1; |
| 992 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 993 |
} |
| 994 |
else { |
| 995 |
const int jtmp = ((j + 1) * (j + 1)) + 2 * i + 2; |
| 996 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 997 |
queue[ipos]->parents->push_back(task_p[jtmp + 1]); |
| 998 |
} |
| 999 |
} |
| 1000 |
else { |
| 1001 |
// if (k > 0) { |
| 1002 |
// c^{k-1}_{i+1,j+1} |
| 1003 |
parent_id = (task_ptr[k - 1] + (num_block - k + 2) + |
| 1004 |
((j + 1) * (j + 2)) / 2 + (i + 1)); |
| 1005 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1006 |
} |
| 1007 |
if (i == 0) { |
| 1008 |
parent_id = task_ptr[k] + 1; // b^k_i |
| 1009 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1010 |
} |
| 1011 |
else { |
| 1012 |
parent_id = task_ptr[k] + 3 + i; |
| 1013 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1014 |
} // if (i == 0) |
| 1015 |
// by definition of the loop, i < j |
| 1016 |
parent_id = task_ptr[k] + 3 + j; // b^k_j |
| 1017 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1018 |
} // scope for char *task_name_cstr :: task c^k_{i,j} |
| 1019 |
} // loop : i |
| 1020 |
|
| 1021 |
// task c^k_{j,j} |
| 1022 |
{ |
| 1023 |
if (j == 0) { |
| 1024 |
ipos = task_ptr[k] + 2; |
| 1025 |
atomic_size = 3; |
| 1026 |
atomic_id = 1; |
| 1027 |
} |
| 1028 |
else { |
| 1029 |
ipos = (task_ptr[k] + |
| 1030 |
2 + // a^0 a^1 |
| 1031 |
(num_block - k -1) + // b^0_0 ,... b^0_{num_blok-k-2} |
| 1032 |
(j * (j + 1)) / 2 + // size of upper triangle |
| 1033 |
j); |
| 1034 |
atomic_size = 1; |
| 1035 |
atomic_id = 0; |
| 1036 |
} |
| 1037 |
string task_name = ("c " + to_string(k) + " " + to_string(j) + " " |
| 1038 |
+ to_string(j) + " : " + to_string(_level) |
| 1039 |
+ " : " + to_string(_nb)); |
| 1040 |
// char *task_name_cstr = new char[task_name.str().size() + 1]; |
| 1041 |
// strcpy(task_name_cstr, task_name.str().c_str()); |
| 1042 |
const long nrowl = (long)nrow; |
| 1043 |
const long ncoll = (long)ncol; |
| 1044 |
const long ops = nrowl * ncoll * (ncoll + 1L); |
| 1045 |
// non-optimized gemm' : opt. factor = 1 |
| 1046 |
C_dupdateb_Schur_arg<T> *arg = |
| 1047 |
new C_dupdateb_Schur_arg<T>(_isSym, |
| 1048 |
task_position, |
| 1049 |
_level, |
| 1050 |
num_block, |
| 1051 |
k, |
| 1052 |
_diag, // D, |
| 1053 |
_factorize_LDLt, |
| 1054 |
// _factorize_LDLt_work, |
| 1055 |
n, |
| 1056 |
nrow, // int nrow |
| 1057 |
ncol, // int ncol |
| 1058 |
SIZE_B1, |
| 1059 |
k, |
| 1060 |
k + j + 1, |
| 1061 |
(-1), |
| 1062 |
verbose, |
| 1063 |
fp, |
| 1064 |
_nb); // jj |
| 1065 |
*(arg->ops_complexity) = ops; |
| 1066 |
|
| 1067 |
queue[ipos] = new C_task(C_DHALF_SCHUR_B, |
| 1068 |
task_name, |
| 1069 |
(void *)arg, |
| 1070 |
C_dupdateb_Schur_diag<T>, |
| 1071 |
atomic_size, |
| 1072 |
atomic_id, |
| 1073 |
arg->ops_complexity // ops_complexity |
| 1074 |
); |
| 1075 |
task_indcol[jpos++] = ipos; |
| 1076 |
if (j > 0) { |
| 1077 |
// c^k_00 is computed with b^k_0 and a^{k+1} |
| 1078 |
queue[ipos]->parallel_max = ((num_block - k - 1) * |
| 1079 |
(num_block - k)) / 2 - 1; |
| 1080 |
queue[ipos]->parallel_id = (j * (j + 1)) / 2 + j - 1 ; |
| 1081 |
} |
| 1082 |
else { |
| 1083 |
queue[ipos]->parallel_max = (-1); |
| 1084 |
queue[ipos]->parallel_id = 0; |
| 1085 |
} |
| 1086 |
if (k == 0) { |
| 1087 |
// depndency on dgemm/dsub of previous factorization level |
| 1088 |
// (j + 1)-th row, (j + 1)-th column |
| 1089 |
if (_isSym || !isChldrnAlgnd) { |
| 1090 |
const int jtmp = ((j + 1) * (j + 2)) / 2 + j + 1; |
| 1091 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 1092 |
} |
| 1093 |
else { |
| 1094 |
const int jtmp = (j + 1) * (j + 1) + 2 * j + 2; |
| 1095 |
queue[ipos]->parents->push_back(task_p[jtmp]); |
| 1096 |
} |
| 1097 |
} |
| 1098 |
else { |
| 1099 |
// if (k > 0) { |
| 1100 |
// c^{k-1}_{j+1,j+1} |
| 1101 |
parent_id = (task_ptr[k - 1] + (num_block - k + 2) + |
| 1102 |
((j + 1) * (j + 2)) / 2 + (j + 1)); |
| 1103 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1104 |
} |
| 1105 |
// else { depndency to dgemm of previous factorization level } |
| 1106 |
if (j > 0) { |
| 1107 |
parent_id = task_ptr[k] + 3 + j; // b^k_j |
| 1108 |
queue[ipos]->parents->push_back(queue[parent_id]); |
| 1109 |
} |
| 1110 |
// no need to write dependency : sequential operation inside of atom |
| 1111 |
// resolves dependency |
| 1112 |
// else { |
| 1113 |
// parent_id = task_ptr[k] + 1; // b^k_0 |
| 1114 |
// queue[ipos]->parents->push_back(queue[parent_id]); |
| 1115 |
//} |
| 1116 |
} // scope for char *task_name_cstr : c^k_{j,j} |
| 1117 |
} // loop : j |
| 1118 |
} // loop : k |
| 1119 |
|
| 1120 |
if (_level == 0) { // 22 Jan.2013 : Atsushi : without refact. for level > 0 |
| 1121 |
// queue for refactorization with full pivot strategy |
| 1122 |
ipos = task_ptr[num_block]; |
| 1123 |
for (int k = 0; k < num_block; k++) { |
| 1124 |
const int nrow = _diag->nrowBlock(k); |
| 1125 |
int task_position; |
| 1126 |
task_position = 0; |
| 1127 |
|
| 1128 |
if (k == 0) { |
| 1129 |
task_position = 1; |
| 1130 |
} |
| 1131 |
if (k == (num_block - 1)) { |
| 1132 |
task_position += 2; |
| 1133 |
} |
| 1134 |
// task a^k |
| 1135 |
{ // scope for char *task_name_cstr |
| 1136 |
// pv_param.pivot is updating during factorizaion |
| 1137 |
string task_name = ("A " + to_string(k) + " : " +to_string(_level) |
| 1138 |
+ " : " + to_string(_nb)); |
| 1139 |
const long nrowl = (long)nrow; |
| 1140 |
const long ops = nrowl * (nrowl + 1L) * (nrowl + 2L) + nrowl; |
| 1141 |
C_dfull_gauss_arg<T, U> *arg = |
| 1142 |
new C_dfull_gauss_arg<T, U>(_isSym, |
| 1143 |
task_position, // int task_position |
| 1144 |
_level, |
| 1145 |
num_block, |
| 1146 |
k, |
| 1147 |
_diag, // D, |
| 1148 |
// _lower, |
| 1149 |
_localSchur, |
| 1150 |
_factorize_LDLt, |
| 1151 |
//_factorize_LDLt_diag, // diag |
| 1152 |
(int *)NULL, // int *permute_block |
| 1153 |
n, // int n |
| 1154 |
upper_ncol, // lower matrix size |
| 1155 |
nrow, // int nrow |
| 1156 |
k, //kk, // int i1 |
| 1157 |
eps_piv, |
| 1158 |
pivot, |
| 1159 |
pivot0, |
| 1160 |
pivot1, |
| 1161 |
kernel_detection, |
| 1162 |
aug_dim, |
| 1163 |
eps_machine, |
| 1164 |
verbose, |
| 1165 |
fp, |
| 1166 |
_nb); |
| 1167 |
*(arg->ops_complexity) = ops; |
| 1168 |
queue[ipos] = new C_task(C_DFULL_SYM_GAUSS, |
| 1169 |
task_name, |
| 1170 |
// task_name_cstr, |
| 1171 |
(void *)arg, |
| 1172 |
C_gauss_whole_pivot<T, U>, |
| 1173 |
atomic_size, |
| 1174 |
atomic_id, |
| 1175 |
arg->ops_complexity // ops_complexity |
| 1176 |
); |
| 1177 |
arg->quit = &queue[ipos]->quit_queue; |
| 1178 |
queue[ipos]->fp = &(arg->fp); |
| 1179 |
task_indcol[jpos++] = ipos; |
| 1180 |
queue[ipos]->parallel_max = 1; |
| 1181 |
queue[ipos]->parallel_id = 0; |
| 1182 |
queue[ipos]->to_next_task = (((num_block - 1 - k) * (num_block - k) * |
| 1183 |
(num_block + 1 - k)) / 6 + |
| 1184 |
num_block - k - 1); |
| 1185 |
if (k == 0) { |
| 1186 |
const int jj = task_ptr[num_block - 1]; |
| 1187 |
queue[ipos]->parents->push_back(queue[jj]); // the last |
| 1188 |
} |
| 1189 |
else { |
| 1190 |
// depending on all C_dupdateb_Schur_offdiagt()s in the previous level |
| 1191 |
const int jbegin = task_ptr[(k - 1) + num_block] + 1; |
| 1192 |
const int jend = task_ptr[k + num_block]; |
| 1193 |
for (int j = jbegin; j < jend; j++) { |
| 1194 |
queue[ipos]->parents->push_back(queue[j]); |
| 1195 |
} |
| 1196 |
} |
| 1197 |
ipos++; |
| 1198 |
} // scope for char *task_name_cstr |
| 1199 |
int itmp = 0; |
| 1200 |
for (int j = 0; j < (num_block - 1 - k); j++) { |
| 1201 |
const int jj = k + j + 1; |
| 1202 |
// const int nrow1 = (j == (num_block - 2 - k)) ? size_res : SIZE_B1; |
| 1203 |
const int nrow1 = _diag->nrowBlock(jj); |
| 1204 |
for (int i = j; i < (num_block - 1 - k); i++) { |
| 1205 |
const int ii = k + i + 1; |
| 1206 |
// const int ncol1 = (i == (num_block - 2 - k)) ? size_res : SIZE_B1; |
| 1207 |
const int ncol1 = _diag->nrowBlock(ii); |
| 1208 |
// task c^k_{i,j} |
| 1209 |
{ |
| 1210 |
string task_name = ("C " + to_string(k) + " " + to_string(i) |
| 1211 |
+ " " + to_string(j) + " : " + to_string(_level) |
| 1212 |
+ " : " + to_string(_nb)); |
| 1213 |
const long nrowl = (long)nrow1; |
| 1214 |
const long ncoll = (long)ncol1; |
| 1215 |
const long ops = nrowl * nrowl * ncoll * 2L; |
| 1216 |
// optimized BLAS3 gemm : opt. factor = 1/0.5 |
| 1217 |
C_dupdateb_Schur_arg<T> *arg = |
| 1218 |
new C_dupdateb_Schur_arg<T>(_isSym, |
| 1219 |
task_position, |
| 1220 |
_level, |
| 1221 |
num_block, |
| 1222 |
k, |
| 1223 |
_diag, // D, |
| 1224 |
_factorize_LDLt, |
| 1225 |
n, |
| 1226 |
nrow1, |
| 1227 |
ncol1, |
| 1228 |
SIZE_B1, |
| 1229 |
k, //kk, |
| 1230 |
ii, // k + i + 1 |
| 1231 |
jj, // k + j + 1, |
| 1232 |
verbose, |
| 1233 |
fp, |
| 1234 |
_nb); |
| 1235 |
*(arg->ops_complexity) = ops; |
| 1236 |
queue[ipos] = new C_task(C_DHALF_SCHUR_BT, |
| 1237 |
task_name, |
| 1238 |
(void *)arg, |
| 1239 |
C_dupdateb_Schur_offdiag_t<T>, |
| 1240 |
1, // atomic_size |
| 1241 |
0, // atomic_id |
| 1242 |
arg->ops_complexity // ops_complexity |
| 1243 |
); |
| 1244 |
task_indcol[jpos++] = ipos; |
| 1245 |
// |
| 1246 |
// c^k_00 is computed with b^k_0 and a^{k+1} |
| 1247 |
queue[ipos]->parallel_max = ((num_block - k - 1) * |
| 1248 |
(num_block - k)) / 2; |
| 1249 |
queue[ipos]->parallel_id = itmp++; // itmp = i + j * n_block - ... |
| 1250 |
const int jj = task_ptr[k + num_block]; |
| 1251 |
queue[ipos]->parents->push_back(queue[jj]); |
| 1252 |
ipos++; |
| 1253 |
} |
| 1254 |
} // loop : j |
| 1255 |
} // loop : i |
| 1256 |
} // loop : k |
| 1257 |
// nop += (double)n * (double)n * (double)n / 3.0; |
| 1258 |
} // if (_level == 0) |
| 1259 |
// |
| 1260 |
return ipos; |
| 1261 |
} |
| 1262 |
|
| 1263 |
template |
| 1264 |
int DissectionMatrix<double>:: |
| 1265 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1266 |
vector<int>& task_indcol, |
| 1267 |
vector<int>& task_ptr, |
| 1268 |
double *eps_piv, |
| 1269 |
bool *kernel_detection, |
| 1270 |
int *aug_dim, |
| 1271 |
double *eps_machine, |
| 1272 |
double *pivot, |
| 1273 |
double *pivot0, |
| 1274 |
double *pivot1, |
| 1275 |
vector<C_task*>& task_p, |
| 1276 |
const bool isChldrnAlgnd, |
| 1277 |
const bool verbose, |
| 1278 |
FILE **fp); |
| 1279 |
|
| 1280 |
template |
| 1281 |
int DissectionMatrix<complex<double>, double>:: |
| 1282 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1283 |
vector<int>& task_indcol, |
| 1284 |
vector<int>& task_ptr, |
| 1285 |
double *eps_piv, |
| 1286 |
bool *kernel_detection, |
| 1287 |
int *aug_dim, |
| 1288 |
double *eps_machine, |
| 1289 |
double *pivot, |
| 1290 |
double *pivot0, |
| 1291 |
double *pivot1, |
| 1292 |
vector<C_task*>& task_p, |
| 1293 |
const bool isChldrnAlgnd, |
| 1294 |
const bool verbose, |
| 1295 |
FILE **fp); |
| 1296 |
|
| 1297 |
template |
| 1298 |
int DissectionMatrix<quadruple>:: |
| 1299 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1300 |
vector<int>& task_indcol, |
| 1301 |
vector<int>& task_ptr, |
| 1302 |
double *eps_piv, |
| 1303 |
bool *kernel_detection, |
| 1304 |
int *aug_dim, |
| 1305 |
quadruple *eps_machine, |
| 1306 |
double *pivot, |
| 1307 |
double *pivot0, |
| 1308 |
double *pivot1, |
| 1309 |
vector<C_task*>& task_p, |
| 1310 |
const bool isChldrnAlgnd, |
| 1311 |
const bool verbose, |
| 1312 |
FILE **fp); |
| 1313 |
|
| 1314 |
template |
| 1315 |
int DissectionMatrix<complex<quadruple>, quadruple >:: |
| 1316 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1317 |
vector<int>& task_indcol, |
| 1318 |
vector<int>& task_ptr, |
| 1319 |
double *eps_piv, |
| 1320 |
bool *kernel_detection, |
| 1321 |
int *aug_dim, |
| 1322 |
quadruple *eps_machine, |
| 1323 |
double *pivot, |
| 1324 |
double *pivot0, |
| 1325 |
double *pivot1, |
| 1326 |
vector<C_task*>& task_p, |
| 1327 |
const bool isChldrnAlgnd, |
| 1328 |
const bool verbose, |
| 1329 |
FILE **fp); |
| 1330 |
|
| 1331 |
template |
| 1332 |
int DissectionMatrix<float>:: |
| 1333 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1334 |
vector<int>& task_indcol, |
| 1335 |
vector<int>& task_ptr, |
| 1336 |
double *eps_piv, |
| 1337 |
bool *kernel_detection, |
| 1338 |
int *aug_dim, |
| 1339 |
float *eps_machine, |
| 1340 |
double *pivot, |
| 1341 |
double *pivot0, |
| 1342 |
double *pivot1, |
| 1343 |
vector<C_task*>& task_p, |
| 1344 |
const bool isChldrnAlgnd, |
| 1345 |
const bool verbose, |
| 1346 |
FILE **fp); |
| 1347 |
|
| 1348 |
template |
| 1349 |
int DissectionMatrix<complex<float>, float>:: |
| 1350 |
C_DFullLDLt_queue(vector<C_task*>& queue, |
| 1351 |
vector<int>& task_indcol, |
| 1352 |
vector<int>& task_ptr, |
| 1353 |
double *eps_piv, |
| 1354 |
bool *kernel_detection, |
| 1355 |
int *aug_dim, |
| 1356 |
float *eps_machine, |
| 1357 |
double *pivot, |
| 1358 |
double *pivot0, |
| 1359 |
double *pivot1, |
| 1360 |
vector<C_task*>& task_p, |
| 1361 |
const bool isChldrnAlgnd, |
| 1362 |
const bool verbose, |
| 1363 |
FILE **fp); |
| 1364 |
// |
| 1365 |
|
| 1366 |
template<typename T, typename U> |
| 1367 |
int DissectionMatrix<T, U>:: |
| 1368 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1369 |
vector<list<int> > &qparents_index, |
| 1370 |
vector<int> &queue_index, |
| 1371 |
vector<int> &indcol, |
| 1372 |
vector<int> &ptr, |
| 1373 |
Dissection::Tree *btree, |
| 1374 |
vector<C_task*> &task_o, |
| 1375 |
vector<int> &task_o_indcol, |
| 1376 |
vector<int> &task_o_ptr, |
| 1377 |
vector<C_task*> &task_p, |
| 1378 |
const bool verbose, |
| 1379 |
FILE **fp) |
| 1380 |
{ |
| 1381 |
int itmp, jtmp; |
| 1382 |
const int nrow = getUpperNRow(); // _nrow |
| 1383 |
const int num_block = _diag->num_blocks(); |
| 1384 |
const int task_p_offset = (num_block * (num_block + 1)) / 2; |
| 1385 |
const int num_block_col = _upper->num_blocks_c(); // |
| 1386 |
vector<int> &singidx = singIdx(); |
| 1387 |
if (nrow == 0) { |
| 1388 |
queue.resize(1); |
| 1389 |
string task_name = ("du dummy : " + |
| 1390 |
to_string(_level) + " : " +to_string(_nb)); |
| 1391 |
C_dummy_arg *arg = new C_dummy_arg(verbose, fp, _nb); |
| 1392 |
// *(arg->ops_complexity) = (-1L); |
| 1393 |
queue[0] = new C_task(C_DUMMY, |
| 1394 |
task_name, |
| 1395 |
(void *)arg, |
| 1396 |
C_dummy, |
| 1397 |
1, // atomic_size, |
| 1398 |
0, // atomic_id, |
| 1399 |
arg->ops_complexity); |
| 1400 |
queue[0]->parents->clear(); |
| 1401 |
return 1; |
| 1402 |
} |
| 1403 |
itmp = ((num_block * (num_block + 1)) / 2) * num_block_col; |
| 1404 |
if (!_isSym) { |
| 1405 |
itmp *= 2; |
| 1406 |
} |
| 1407 |
queue.resize(itmp); |
| 1408 |
qparents_index.resize(itmp); |
| 1409 |
queue_index.resize(itmp); |
| 1410 |
// initialize |
| 1411 |
for (int i = 0; i < itmp; i++) { |
| 1412 |
queue_index[i] = i; |
| 1413 |
} |
| 1414 |
// vector<int> ptr, indcol; |
| 1415 |
ptr.resize(num_block + 1); |
| 1416 |
jtmp = (num_block + 1) * num_block; |
| 1417 |
itmp = _isSym ? (jtmp / 2) : jtmp; |
| 1418 |
indcol.resize(itmp); // upper and lower are stored sequentially |
| 1419 |
ptr[0] = 0; |
| 1420 |
for (int k = 0; k < num_block; k++) { |
| 1421 |
ptr[k + 1] = ptr[k] + (num_block - k); // based on the symmetric case |
| 1422 |
} |
| 1423 |
int ipos, jpos, atomic_size, atomic_id; |
| 1424 |
jpos = 0; |
| 1425 |
for (int k = 0; k < num_block; k++) { |
| 1426 |
if (k == 0) { |
| 1427 |
ipos = 0; |
| 1428 |
atomic_size = 1; |
| 1429 |
atomic_id = 0; |
| 1430 |
} |
| 1431 |
else { |
| 1432 |
ipos = _isSym ? (ptr[k - 1] + 2) : (ptr[k - 1] + 2) * 2; |
| 1433 |
atomic_size = 2; |
| 1434 |
atomic_id = 1; |
| 1435 |
} |
| 1436 |
int nrow_block = _diag->nrowBlock(k, k); |
| 1437 |
const long nrow_blockl = (long)nrow_block; |
| 1438 |
int iipos = ipos * num_block_col; |
| 1439 |
for (int l = 0; l < num_block_col; l++) { |
| 1440 |
int nrhs_block = _upper->ncolBlock(l); |
| 1441 |
const long nrhs_blockl = (long)nrhs_block; |
| 1442 |
const long ops = nrow_blockl * nrow_blockl *nrhs_blockl; |
| 1443 |
DTRSMScale_arg<T> *arg = |
| 1444 |
new DTRSMScale_arg<T>(_isSym, |
| 1445 |
_diag, // ldlt, |
| 1446 |
_upper, // |
| 1447 |
_lower, // not yet allocated |
| 1448 |
// pt_offset, |
| 1449 |
nrow, |
| 1450 |
nrhs_block, |
| 1451 |
k, // |
| 1452 |
l, |
| 1453 |
(-1), // mblock |
| 1454 |
&singidx, |
| 1455 |
true, // localPermute |
| 1456 |
verbose, |
| 1457 |
fp, |
| 1458 |
_nb); |
| 1459 |
*(arg->ops_complexity) = ops; |
| 1460 |
string task_name = ("du " + to_string(k) + " " + to_string(l) |
| 1461 |
+ " : " + to_string(_level) + " : " |
| 1462 |
+ to_string(_nb)); |
| 1463 |
queue[iipos] = new C_task(C_DTRSMSCALE, |
| 1464 |
task_name, |
| 1465 |
(void *)arg, |
| 1466 |
C_DTRSMScale_diag_upper<T>, |
| 1467 |
atomic_size, |
| 1468 |
atomic_id, |
| 1469 |
arg->ops_complexity); |
| 1470 |
queue[iipos]->fp = &(arg->fp); |
| 1471 |
// dependency on LDLt : alpha^(k) |
| 1472 |
jtmp = task_o_indcol[task_o_ptr[k]]; |
| 1473 |
queue[iipos]->parents->push_back(task_o[jtmp]); |
| 1474 |
if (k == 0) { |
| 1475 |
queue[iipos]->parents->push_back(task_p[task_p_offset + l]); |
| 1476 |
} |
| 1477 |
else { |
| 1478 |
if (_isSym) { |
| 1479 |
jtmp = indcol[ptr[k - 1]] * num_block_col + l; |
| 1480 |
} |
| 1481 |
else { |
| 1482 |
jtmp = indcol[2 * ptr[k - 1]] * num_block_col + l; |
| 1483 |
} |
| 1484 |
// queue[iipos]->parents->push_back(queue[jtmp]); |
| 1485 |
qparents_index[iipos].push_back(jtmp); |
| 1486 |
} |
| 1487 |
indcol[jpos] = ipos; |
| 1488 |
iipos++; |
| 1489 |
} //loop : l |
| 1490 |
if (!_isSym) { |
| 1491 |
for (int l = 0; l < num_block_col; l++) { |
| 1492 |
int nrhs_block = _lower->ncolBlock(l); |
| 1493 |
const long nrhs_blockl = (long)nrhs_block; |
| 1494 |
// lower DTRSM without scaling |
| 1495 |
// to prevent elimination from the task queue to keep task-dependency |
| 1496 |
const long ops = nrow_blockl == 1L ? 1L : (nrow_blockl * (nrow_blockl - 1L) * nrhs_blockl); |
| 1497 |
DTRSMScale_arg<T> *arg = |
| 1498 |
new DTRSMScale_arg<T>(_isSym, |
| 1499 |
_diag, //ldlt, |
| 1500 |
(RectBlockMatrix<T> *)NULL, |
| 1501 |
_lower, // not yet allocated |
| 1502 |
// pt_offset, |
| 1503 |
nrow, |
| 1504 |
nrhs_block, |
| 1505 |
k, // |
| 1506 |
l, |
| 1507 |
(-1), // mblock |
| 1508 |
&singidx, |
| 1509 |
true, // localPermute |
| 1510 |
verbose, |
| 1511 |
fp, |
| 1512 |
_nb); |
| 1513 |
*(arg->ops_complexity) = ops; |
| 1514 |
|
| 1515 |
string task_name = ("dl " + to_string(k) + " " + to_string(l) |
| 1516 |
+ " : " + to_string(_level) + " : " |
| 1517 |
+ to_string(_nb)); |
| 1518 |
queue[iipos] = new C_task(C_DTRSMSCALE, |
| 1519 |
task_name, |
| 1520 |
(void *)arg, |
| 1521 |
C_DTRSMScale_diag_lower<T>, |
| 1522 |
atomic_size, |
| 1523 |
atomic_id, |
| 1524 |
arg->ops_complexity); |
| 1525 |
queue[iipos]->fp = &(arg->fp); |
| 1526 |
// dependency on LDLt : alpha^(k) |
| 1527 |
jtmp = task_o_indcol[task_o_ptr[k]]; |
| 1528 |
queue[iipos]->parents->push_back(task_o[jtmp]); |
| 1529 |
if (k == 0) { |
| 1530 |
queue[iipos]->parents->push_back(task_p[task_p_offset + l]); |
| 1531 |
} |
| 1532 |
else { |
| 1533 |
jtmp = indcol[2 * ptr[k - 1] + 1] * num_block_col + l; |
| 1534 |
// queue[iipos]->parents->push_back(queue[jtmp]); |
| 1535 |
qparents_index[iipos].push_back(jtmp); |
| 1536 |
} |
| 1537 |
iipos++; |
| 1538 |
indcol[jpos + 1] = ipos + 1; |
| 1539 |
} |
| 1540 |
} // loop : l |
| 1541 |
jpos += _isSym ? 1 : 2; |
| 1542 |
for (int m = (k + 1); m < num_block; m++) { |
| 1543 |
if (m == (k + 1)) { |
| 1544 |
ipos = _isSym ? (ptr[k] + 1) : |
| 1545 |
((ptr[k] + 1) * 2); |
| 1546 |
atomic_size = 2; |
| 1547 |
atomic_id = 0; |
| 1548 |
} |
| 1549 |
else { |
| 1550 |
ipos = _isSym ? (ptr[k] + (m - k + 1)) : |
| 1551 |
((ptr[k] + (m - k + 1)) * 2); |
| 1552 |
atomic_size = 1; |
| 1553 |
atomic_id = 0; |
| 1554 |
} |
| 1555 |
int ncol_block = _diag->ncolBlock(k, m); |
| 1556 |
const long ncol_blockl = (long)ncol_block; |
| 1557 |
int iipos = ipos * num_block_col; |
| 1558 |
for (int l = 0; l < num_block_col; l++) { |
| 1559 |
int nrhs_block = _upper->ncolBlock(l); |
| 1560 |
const long nrhs_blockl = (long)nrhs_block; |
| 1561 |
const long ops = (2L * nrow_blockl * ncol_blockl * nrhs_blockl); |
| 1562 |
DTRSMScale_arg<T> *arg = |
| 1563 |
new DTRSMScale_arg<T>(_isSym, |
| 1564 |
_diag, //ldlt, |
| 1565 |
_upper, // |
| 1566 |
_lower, // not yet allocated |
| 1567 |
// pt_offset, |
| 1568 |
nrow, |
| 1569 |
nrhs_block, |
| 1570 |
k, // |
| 1571 |
l, |
| 1572 |
m, // mblock |
| 1573 |
&singidx, |
| 1574 |
true, // localPermute |
| 1575 |
verbose, |
| 1576 |
fp, |
| 1577 |
_nb); |
| 1578 |
|
| 1579 |
string task_name = ("dU " + to_string(k) + " " + to_string(m) |
| 1580 |
+ " " + to_string(l) + " : " + to_string(_level) |
| 1581 |
+ " : " + to_string(_nb)); |
| 1582 |
|
| 1583 |
*(arg->ops_complexity) = ops; |
| 1584 |
queue[iipos] = new C_task(C_DTRSMSCALE, |
| 1585 |
task_name, |
| 1586 |
(void *)arg, |
| 1587 |
C_DTRSMScale_offdiag_upper<T>, |
| 1588 |
atomic_size, |
| 1589 |
atomic_id, |
| 1590 |
arg->ops_complexity); |
| 1591 |
queue[iipos]->fp = &(arg->fp); |
| 1592 |
// Dependency on LDLt : beta^(k)_(m) |
| 1593 |
jtmp = task_o_indcol[task_o_ptr[k] + m - k]; |
| 1594 |
queue[iipos]->parents->push_back(task_o[jtmp]); |
| 1595 |
jtmp = (indcol[_isSym ? ptr[k] : ptr[k] * 2] * num_block_col + l); |
| 1596 |
qparents_index[iipos].push_back(jtmp); // |
| 1597 |
if (k > 0) { |
| 1598 |
const int ktmp = (_isSym ? (ptr[k - 1] + m - k + 1) : |
| 1599 |
((ptr[k - 1] + m - k + 1) * 2)); |
| 1600 |
jtmp = (indcol[ktmp] * num_block_col + l); |
| 1601 |
qparents_index[iipos].push_back(jtmp); // |
| 1602 |
} |
| 1603 |
indcol[jpos] = ipos; |
| 1604 |
iipos++; |
| 1605 |
} |
| 1606 |
if (!_isSym) { |
| 1607 |
for (int l = 0; l < num_block_col; l++) { |
| 1608 |
int nrhs_block = _lower->ncolBlock(l); |
| 1609 |
const long nrhs_blockl = (long)nrhs_block; |
| 1610 |
const long ops = (2L * nrow_blockl * ncol_blockl * nrhs_blockl); |
| 1611 |
DTRSMScale_arg<T> *arg = |
| 1612 |
new DTRSMScale_arg<T>(_isSym, |
| 1613 |
_diag, //ldlt, |
| 1614 |
(RectBlockMatrix<T> *)NULL, |
| 1615 |
_lower, // not yet allocated |
| 1616 |
// pt_offset, |
| 1617 |
nrow, |
| 1618 |
nrhs_block, |
| 1619 |
k, // |
| 1620 |
l, |
| 1621 |
m, // mblock |
| 1622 |
&singidx, |
| 1623 |
true, // localPermute |
| 1624 |
verbose, |
| 1625 |
fp, |
| 1626 |
_nb); |
| 1627 |
*(arg->ops_complexity) = ops; |
| 1628 |
|
| 1629 |
string task_name = ("dL " + to_string(k) + " " + to_string(m) |
| 1630 |
+ " " + to_string(l) + " : " + to_string(_level) |
| 1631 |
+ " : " + to_string(_nb)); |
| 1632 |
|
| 1633 |
queue[iipos] = new C_task(C_DTRSMSCALE, |
| 1634 |
task_name, |
| 1635 |
(void *)arg, |
| 1636 |
C_DTRSMScale_offdiag_lower<T>, |
| 1637 |
atomic_size, |
| 1638 |
atomic_id, |
| 1639 |
arg->ops_complexity); |
| 1640 |
queue[iipos]->fp = &(arg->fp); |
| 1641 |
// dependency on LDLt : beta^(k)_(m) |
| 1642 |
jtmp = task_o_indcol[task_o_ptr[k] + m - k]; |
| 1643 |
queue[iipos]->parents->push_back(task_o[jtmp]); |
| 1644 |
jtmp = indcol[2 * ptr[k] + 1] * num_block_col + l; |
| 1645 |
qparents_index[iipos].push_back(jtmp); // k-th beginning block |
| 1646 |
if (k > 0) { |
| 1647 |
const int ktmp = (ptr[k - 1] + m - k + 1) * 2 + 1; |
| 1648 |
jtmp = (indcol[ktmp] * num_block_col + l); |
| 1649 |
qparents_index[iipos].push_back(jtmp); // |
| 1650 |
} |
| 1651 |
iipos++; |
| 1652 |
indcol[jpos + 1] = ipos + 1; |
| 1653 |
} // if (!isSym) |
| 1654 |
} // loop : l |
| 1655 |
jpos += _isSym ? 1 : 2; |
| 1656 |
} // loop : m |
| 1657 |
} // loop k |
| 1658 |
return queue.size(); |
| 1659 |
} |
| 1660 |
|
| 1661 |
template |
| 1662 |
int DissectionMatrix<double>:: |
| 1663 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1664 |
vector<list<int> > &qparents_index, |
| 1665 |
vector<int> &queue_index, |
| 1666 |
vector<int> &indcol, |
| 1667 |
vector<int> &ptr, |
| 1668 |
Dissection::Tree *btree, |
| 1669 |
vector<C_task*> &task_o, |
| 1670 |
vector<int> &task_o_indcol, |
| 1671 |
vector<int> &task_o_ptr, |
| 1672 |
vector<C_task*> &task_p, |
| 1673 |
const bool verbose, |
| 1674 |
FILE **fp); |
| 1675 |
|
| 1676 |
template |
| 1677 |
int DissectionMatrix<complex<double>, double>:: |
| 1678 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1679 |
vector<list<int> > &qparents_index, |
| 1680 |
vector<int> &queue_index, |
| 1681 |
vector<int> &indcol, |
| 1682 |
vector<int> &ptr, |
| 1683 |
Dissection::Tree *btree, |
| 1684 |
vector<C_task*> &task_o, |
| 1685 |
vector<int> &task_o_indcol, |
| 1686 |
vector<int> &task_o_ptr, |
| 1687 |
vector<C_task*> &task_p, |
| 1688 |
const bool verbose, |
| 1689 |
FILE **fp); |
| 1690 |
|
| 1691 |
template |
| 1692 |
int DissectionMatrix<quadruple>:: |
| 1693 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1694 |
vector<list<int> > &qparents_index, |
| 1695 |
vector<int> &queue_index, |
| 1696 |
vector<int> &indcol, |
| 1697 |
vector<int> &ptr, |
| 1698 |
Dissection::Tree *btree, |
| 1699 |
vector<C_task*> &task_o, |
| 1700 |
vector<int> &task_o_indcol, |
| 1701 |
vector<int> &task_o_ptr, |
| 1702 |
vector<C_task*> &task_p, |
| 1703 |
const bool verbose, |
| 1704 |
FILE **fp); |
| 1705 |
|
| 1706 |
template |
| 1707 |
int DissectionMatrix<complex<quadruple>, quadruple>:: |
| 1708 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1709 |
vector<list<int> > &qparents_index, |
| 1710 |
vector<int> &queue_index, |
| 1711 |
vector<int> &indcol, |
| 1712 |
vector<int> &ptr, |
| 1713 |
Dissection::Tree *btree, |
| 1714 |
vector<C_task*> &task_o, |
| 1715 |
vector<int> &task_o_indcol, |
| 1716 |
vector<int> &task_o_ptr, |
| 1717 |
vector<C_task*> &task_p, |
| 1718 |
const bool verbose, |
| 1719 |
FILE **fp); |
| 1720 |
|
| 1721 |
template |
| 1722 |
int DissectionMatrix<float>:: |
| 1723 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1724 |
vector<list<int> > &qparents_index, |
| 1725 |
vector<int> &queue_index, |
| 1726 |
vector<int> &indcol, |
| 1727 |
vector<int> &ptr, |
| 1728 |
Dissection::Tree *btree, |
| 1729 |
vector<C_task*> &task_o, |
| 1730 |
vector<int> &task_o_indcol, |
| 1731 |
vector<int> &task_o_ptr, |
| 1732 |
vector<C_task*> &task_p, |
| 1733 |
const bool verbose, |
| 1734 |
FILE **fp); |
| 1735 |
|
| 1736 |
template |
| 1737 |
int DissectionMatrix<complex<float>, float>:: |
| 1738 |
C_DTRSMScale_queue(vector<C_task*> &queue, |
| 1739 |
vector<list<int> > &qparents_index, |
| 1740 |
vector<int> &queue_index, |
| 1741 |
vector<int> &indcol, |
| 1742 |
vector<int> &ptr, |
| 1743 |
Dissection::Tree *btree, |
| 1744 |
vector<C_task*> &task_o, |
| 1745 |
vector<int> &task_o_indcol, |
| 1746 |
vector<int> &task_o_ptr, |
| 1747 |
vector<C_task*> &task_p, |
| 1748 |
const bool verbose, |
| 1749 |
FILE **fp); |
| 1750 |
|
| 1751 |
// |
| 1752 |
|
| 1753 |
|
| 1754 |
template<typename T, typename U> |
| 1755 |
void DissectionMatrix<T, U>:: |
| 1756 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 1757 |
vector<list<int> > &qparents_index, |
| 1758 |
vector<int> &queue_index, |
| 1759 |
vector<int>& indcol, |
| 1760 |
vector<int>& ptr, |
| 1761 |
const bool verbose, |
| 1762 |
FILE *fp) |
| 1763 |
{ |
| 1764 |
int itmp, jtmp; |
| 1765 |
const int num_block = _diag->num_blocks(); |
| 1766 |
const int num_block_col = _upper->num_blocks_c(); |
| 1767 |
|
| 1768 |
vector<C_task *> tmp; |
| 1769 |
vector<int> tmp_index; |
| 1770 |
|
| 1771 |
if (num_block == 1) { |
| 1772 |
if (!_isSym) { |
| 1773 |
tmp.resize(2 * num_block_col); |
| 1774 |
tmp_index.resize(2 * num_block_col); |
| 1775 |
itmp = 0; |
| 1776 |
for (int l = 0; l < _localSchur->num_blocks0(); l++, itmp += 2) { |
| 1777 |
tmp[itmp] = queue[l]; // upper |
| 1778 |
tmp_index[itmp] = queue_index[l]; |
| 1779 |
tmp[itmp + 1] = queue[l + num_block_col]; // lower |
| 1780 |
tmp_index[itmp + 1] = queue_index[l + num_block_col]; |
| 1781 |
} |
| 1782 |
for (int l = _localSchur->num_blocks0(); l < num_block_col; l++, |
| 1783 |
itmp += 2) { |
| 1784 |
tmp[itmp] = queue[l]; // upper |
| 1785 |
tmp_index[itmp] = queue_index[l]; |
| 1786 |
tmp[itmp + 1] = queue[l + num_block_col]; // lower |
| 1787 |
tmp_index[itmp + 1] = queue_index[l + num_block_col]; |
| 1788 |
} |
| 1789 |
for (int i = 0; i < (2 * num_block_col); i++) { |
| 1790 |
queue[i] = tmp[i]; |
| 1791 |
queue_index[i] = tmp_index[i]; |
| 1792 |
} |
| 1793 |
} |
| 1794 |
} |
| 1795 |
else if (num_block == 2) { |
| 1796 |
tmp.resize(3 * num_block_col); |
| 1797 |
tmp_index.resize(3 * num_block_col); |
| 1798 |
if (!_isSym) { |
| 1799 |
swap_queues_n(queue, queue_index, 1, 2, num_block_col, tmp, tmp_index); |
| 1800 |
swap_queues_n(queue, queue_index, 3, 4, num_block_col, tmp, tmp_index); |
| 1801 |
swap_queues_n(queue, queue_index, 2, 3, num_block_col, tmp, tmp_index); |
| 1802 |
} |
| 1803 |
for (int l = 0; l < num_block_col; l++) { |
| 1804 |
tmp[3 * l] = queue[l]; |
| 1805 |
tmp_index[3 * l] = queue_index[l]; |
| 1806 |
tmp[3 * l + 1] = queue[num_block_col + l]; |
| 1807 |
tmp_index[3 * l + 1] = queue_index[num_block_col + l]; |
| 1808 |
tmp[3 * l + 2] = queue[2 * num_block_col + l]; |
| 1809 |
tmp_index[3 * l + 2] = queue_index[2 * num_block_col + l]; |
| 1810 |
for (int m = 0; m < 3; m++) { |
| 1811 |
tmp[3 * l + m]->atomic_size = 3; |
| 1812 |
tmp[3 * l + m]->atomic_id = m; |
| 1813 |
} |
| 1814 |
} |
| 1815 |
for (int l = 0; l < (3 * num_block_col); l++) { |
| 1816 |
queue[l] = tmp[l]; |
| 1817 |
queue_index[l] = tmp_index[l]; |
| 1818 |
} // loop : l |
| 1819 |
if (!_isSym) { |
| 1820 |
for (int l = 0; l < num_block_col; l++) { |
| 1821 |
tmp[3 * l] = queue[3 * num_block_col + l]; |
| 1822 |
tmp_index[3 * l] = queue_index[3 * num_block_col + l]; |
| 1823 |
tmp[3 * l + 1] = queue[4 * num_block_col + l]; |
| 1824 |
tmp_index[3 * l + 1] = queue_index[4 * num_block_col + l]; |
| 1825 |
tmp[3 * l + 2] = queue[5 * num_block_col + l]; |
| 1826 |
tmp_index[3 * l + 2] = queue_index[5 * num_block_col + l]; |
| 1827 |
for (int m = 0; m < 3; m++) { |
| 1828 |
tmp[3 * l + m]->atomic_size = 3; |
| 1829 |
tmp[3 * l + m]->atomic_id = m; |
| 1830 |
} |
| 1831 |
} |
| 1832 |
for (int l = 0; l < (3 * num_block_col); l++) { |
| 1833 |
queue[3 * num_block_col + l] = tmp[l]; |
| 1834 |
queue_index[3 * num_block_col + l] = tmp_index[l]; |
| 1835 |
} // loop : l |
| 1836 |
} |
| 1837 |
if (!_isSym) { |
| 1838 |
tmp.resize(6 * num_block_col); |
| 1839 |
tmp_index.resize(6 * num_block_col); |
| 1840 |
itmp = 0; |
| 1841 |
for (int l = 0; l < _localSchur->num_blocks0(); l++, itmp += 6) { |
| 1842 |
for (int k = 0; k < 3; k++) { |
| 1843 |
tmp[itmp + k] = queue[3 * l + k]; // upper |
| 1844 |
tmp_index[itmp + k] = queue_index[3 * l + k]; |
| 1845 |
tmp[itmp + 3 + k] = queue[3 * (l + num_block_col) + k]; // lower |
| 1846 |
tmp_index[itmp + 3 + k] = queue_index[3 * (l + num_block_col) + k]; |
| 1847 |
} |
| 1848 |
} |
| 1849 |
for (int l = _localSchur->num_blocks0(); l < num_block_col; l++, |
| 1850 |
itmp += 6) { |
| 1851 |
for (int k = 0; k < 3; k++) { |
| 1852 |
tmp[itmp + k] = queue[3 * l + k]; // upper |
| 1853 |
tmp_index[itmp + k] = queue_index[3 * l + k]; |
| 1854 |
tmp[itmp + 3 + k] = queue[3 * (l + num_block_col) + k]; // lower |
| 1855 |
tmp_index[itmp + 3 + k] = queue_index[3 * (l + num_block_col) + k]; |
| 1856 |
} |
| 1857 |
} |
| 1858 |
for (int i = 0; i < (6 * num_block_col); i++) { |
| 1859 |
queue[i] = tmp[i]; |
| 1860 |
queue_index[i] = tmp_index[i]; |
| 1861 |
} |
| 1862 |
} |
| 1863 |
|
| 1864 |
} // if (num_block == 1) else if (num_block == 2) |
| 1865 |
else { |
| 1866 |
tmp.resize(2 * num_block_col); |
| 1867 |
tmp_index.resize(2 * num_block_col); |
| 1868 |
if (!_isSym) { |
| 1869 |
for (int i = 0; i < indcol.size(); i++) { |
| 1870 |
const int ii = i * num_block_col; |
| 1871 |
if ((i % 2 == 1) && (queue[ii]->atomic_size == 2) && |
| 1872 |
(queue[ii]->atomic_id == 0)) { |
| 1873 |
swap_queues_n(queue, queue_index, i, (i + 1), num_block_col, tmp, |
| 1874 |
tmp_index); |
| 1875 |
i++; |
| 1876 |
} |
| 1877 |
} // loop : i |
| 1878 |
} // if (!isSym) |
| 1879 |
for (int i = 0; i < indcol.size(); i++) { |
| 1880 |
const int ii = i * num_block_col; |
| 1881 |
if ((queue[ii]->atomic_size == 2) && (queue[ii]->atomic_id == 0)) { |
| 1882 |
for (int l = 0; l < num_block_col; l++) { |
| 1883 |
tmp[2 * l] = queue[ii + l]; |
| 1884 |
tmp_index[2 * l] = queue_index[ii + l]; |
| 1885 |
tmp[2 * l + 1] = queue[(i + 1) * num_block_col + l]; |
| 1886 |
tmp_index[2 * l + 1] = queue_index[(i + 1) * num_block_col + l]; |
| 1887 |
} |
| 1888 |
for (int l = 0; l < (2 * num_block_col); l++) { |
| 1889 |
queue[ii + l] = tmp[l]; |
| 1890 |
queue_index[ii + l] = tmp_index[l]; |
| 1891 |
} |
| 1892 |
i++; |
| 1893 |
} |
| 1894 |
} // loop : it |
| 1895 |
} // if (num_block == 2) |
| 1896 |
|
| 1897 |
if (num_block < 3) { |
| 1898 |
if (_isSym) { |
| 1899 |
int parallel_max = _localSchur->num_blocks0(); |
| 1900 |
int nsize = ((num_block == 1) ? 1 : 3); |
| 1901 |
for (int l = 0; l < parallel_max; l++) { |
| 1902 |
itmp = l * nsize; |
| 1903 |
for (int k = 0; k < nsize; k++, itmp++) { |
| 1904 |
queue[itmp]->parallel_max = parallel_max; |
| 1905 |
queue[itmp]->parallel_id = l; |
| 1906 |
} |
| 1907 |
} |
| 1908 |
parallel_max = num_block_col - _localSchur->num_blocks0(); |
| 1909 |
for (int l = 0; l < parallel_max; l++) { |
| 1910 |
itmp = (l + _localSchur->num_blocks0()) * nsize; |
| 1911 |
for (int k = 0; k < nsize; k++, itmp++) { |
| 1912 |
queue[itmp]->parallel_max = parallel_max; |
| 1913 |
queue[itmp]->parallel_id = l; |
| 1914 |
} |
| 1915 |
} |
| 1916 |
} |
| 1917 |
else { |
| 1918 |
int parallel_max = _localSchur->num_blocks0() * 2; |
| 1919 |
int nsize = ((num_block == 1) ? 1 : 3); |
| 1920 |
for (int l = 0; l < parallel_max; l++) { |
| 1921 |
itmp = l * nsize; |
| 1922 |
for (int k = 0; k < nsize; k++, itmp++) { |
| 1923 |
queue[itmp]->parallel_max = parallel_max; |
| 1924 |
queue[itmp]->parallel_id = l; |
| 1925 |
} |
| 1926 |
} |
| 1927 |
parallel_max = (num_block_col - _localSchur->num_blocks0()) * 2; |
| 1928 |
for (int l = 0; l < parallel_max; l++) { |
| 1929 |
itmp = (l + 2 * _localSchur->num_blocks0()) * nsize; |
| 1930 |
for (int k = 0; k < nsize; k++, itmp++) { |
| 1931 |
queue[itmp]->parallel_max = parallel_max; |
| 1932 |
queue[itmp]->parallel_id = l; |
| 1933 |
} |
| 1934 |
} |
| 1935 |
} |
| 1936 |
} |
| 1937 |
else { // if (num_block < 3) |
| 1938 |
int parallel_max = (_isSym ? 1 : 2) * num_block_col; |
| 1939 |
for (int l = 0; l < num_block_col; l++) { |
| 1940 |
queue[l]->parallel_max = parallel_max; |
| 1941 |
queue[l]->parallel_id = l; |
| 1942 |
} |
| 1943 |
if (!_isSym) { |
| 1944 |
for (int l = 0; l < num_block_col; l++) { |
| 1945 |
queue[num_block_col + l]->parallel_max = parallel_max; |
| 1946 |
queue[num_block_col + l]->parallel_id = num_block_col + l; |
| 1947 |
} |
| 1948 |
} |
| 1949 |
for (int k = 0; k < (num_block - 1); k++) { |
| 1950 |
if (_isSym) { |
| 1951 |
parallel_max = (ptr[k + 1] - ptr[k] - 1) * num_block_col; |
| 1952 |
jtmp = 0; |
| 1953 |
for (int i = (ptr[k] + 1); i < (ptr[k + 1] + 1); i++) { |
| 1954 |
itmp = i * num_block_col; |
| 1955 |
for (int l = 0; l < num_block_col; l++, itmp++) { |
| 1956 |
queue[itmp]->parallel_max = parallel_max; |
| 1957 |
queue[itmp]->parallel_id = jtmp; |
| 1958 |
if (((queue[itmp]->atomic_size == 2) && |
| 1959 |
(queue[itmp]->atomic_id == 1)) || |
| 1960 |
(queue[itmp]->atomic_size == 1)) { |
| 1961 |
jtmp++; |
| 1962 |
} |
| 1963 |
} // loop : l |
| 1964 |
} // loop : i |
| 1965 |
} // _isSym |
| 1966 |
else { |
| 1967 |
parallel_max = (2 * (ptr[k + 1] - ptr[k]) - 2) * num_block_col; |
| 1968 |
jtmp = 0; |
| 1969 |
for (int i = (ptr[k] * 2 + 2); i < (ptr[k + 1] * 2 + 2); i++) { |
| 1970 |
itmp = i * num_block_col; |
| 1971 |
for (int l = 0; l < num_block_col; l++, itmp++) { |
| 1972 |
queue[itmp]->parallel_max = parallel_max; |
| 1973 |
queue[itmp]->parallel_id = jtmp; |
| 1974 |
if (((queue[itmp]->atomic_size == 2) && |
| 1975 |
(queue[itmp]->atomic_id == 1)) || |
| 1976 |
(queue[itmp]->atomic_size == 1)) { |
| 1977 |
jtmp++; |
| 1978 |
} |
| 1979 |
} // loop : l |
| 1980 |
} // loop : i |
| 1981 |
} |
| 1982 |
} // loop : k |
| 1983 |
} // if (num_block < 2) |
| 1984 |
|
| 1985 |
tmp_index.resize(queue_index.size()); |
| 1986 |
vector<int> tmp_old(queue_index); |
| 1987 |
for (int i = 0; i < queue_index.size(); i++) { |
| 1988 |
tmp_index[queue_index[i]] = i; |
| 1989 |
} |
| 1990 |
for (int i = 0; i < queue_index.size(); i++) { |
| 1991 |
queue_index[i] = tmp_index[i]; |
| 1992 |
} |
| 1993 |
{ // begin : scope j |
| 1994 |
int j = 0; |
| 1995 |
for (vector<C_task *>::const_iterator it = queue.begin(); |
| 1996 |
it != queue.end(); ++it, j++) { |
| 1997 |
const int jj = tmp_old[j]; |
| 1998 |
for (list<int>::const_iterator kt = qparents_index[jj].begin(); |
| 1999 |
kt != qparents_index[jj].end(); ++kt) { |
| 2000 |
(*it)->parents->push_back(queue[queue_index[(*kt)]]); |
| 2001 |
} // loop : kt |
| 2002 |
} // loop : it |
| 2003 |
} // end : scope j |
| 2004 |
|
| 2005 |
// merging all dependency inside of atomic operation : not optimal but |
| 2006 |
// minimal modification of cheking of task dependency during excution |
| 2007 |
for (vector<C_task *>::const_iterator it = queue.begin(); |
| 2008 |
it != queue.end(); ++it) { |
| 2009 |
switch((*it)->atomic_size) { |
| 2010 |
case 2: |
| 2011 |
{ |
| 2012 |
vector<C_task *>::const_iterator jt = it; |
| 2013 |
C_task *task_tmp = (*jt); |
| 2014 |
++it; |
| 2015 |
(*jt)->parents->merge(*((*it)->parents)); |
| 2016 |
(*jt)->parents->unique(); |
| 2017 |
// remove dependency inside of atomic operation |
| 2018 |
for (list<C_task*>::iterator mt = (*jt)->parents->begin(); |
| 2019 |
mt != (*jt)->parents->end(); ++mt) { |
| 2020 |
if ((*mt) == (*jt)) { |
| 2021 |
mt = (*jt)->parents->erase(mt); |
| 2022 |
} |
| 2023 |
} |
| 2024 |
*((*it)->parents) = *((*jt)->parents); |
| 2025 |
(*it)->parents->push_back(task_tmp); |
| 2026 |
} |
| 2027 |
break; |
| 2028 |
case 3: |
| 2029 |
{ |
| 2030 |
vector<C_task *>::const_iterator jt = it; |
| 2031 |
C_task *task_tmp0 = (*jt); |
| 2032 |
++it; |
| 2033 |
(*jt)->parents->merge(*((*it)->parents)); |
| 2034 |
(*jt)->parents->unique(); |
| 2035 |
// remove dependency inside of atomic operation |
| 2036 |
for (list<C_task*>::iterator mt = (*jt)->parents->begin(); |
| 2037 |
mt != (*jt)->parents->end(); ++mt) { |
| 2038 |
if ((*mt) == (*jt)) { |
| 2039 |
task_tmp0 = (*mt); |
| 2040 |
mt = (*jt)->parents->erase(mt); |
| 2041 |
} |
| 2042 |
} |
| 2043 |
vector<C_task *>::const_iterator kt = it; |
| 2044 |
C_task *task_tmp1 = (*kt); |
| 2045 |
++it; |
| 2046 |
(*jt)->parents->merge(*((*it)->parents)); |
| 2047 |
(*jt)->parents->unique(); |
| 2048 |
// remove dependency inside of atomic operation |
| 2049 |
for (list<C_task*>::iterator mt = (*jt)->parents->begin(); |
| 2050 |
mt != (*jt)->parents->end(); ++mt) { |
| 2051 |
if (((*mt) == (*jt)) || ((*mt) == (*kt))) { |
| 2052 |
mt = (*jt)->parents->erase(mt); |
| 2053 |
} |
| 2054 |
} |
| 2055 |
*((*kt)->parents) = *((*jt)->parents); |
| 2056 |
*((*it)->parents) = *((*jt)->parents); |
| 2057 |
(*kt)->parents->push_back(task_tmp0); |
| 2058 |
(*it)->parents->push_back(task_tmp0); |
| 2059 |
(*it)->parents->push_back(task_tmp1); |
| 2060 |
} |
| 2061 |
break; |
| 2062 |
default: |
| 2063 |
break; |
| 2064 |
} |
| 2065 |
} |
| 2066 |
|
| 2067 |
for (vector<C_task *>::const_iterator it = queue.begin(); |
| 2068 |
it != queue.end(); ++it) { |
| 2069 |
(*it)->parents->sort(compare_task_name); |
| 2070 |
(*it)->parents->unique(); |
| 2071 |
} |
| 2072 |
} |
| 2073 |
|
| 2074 |
template |
| 2075 |
void DissectionMatrix<double>:: |
| 2076 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2077 |
vector<list<int> > &qparents_index, |
| 2078 |
vector<int> &queue_index, |
| 2079 |
vector<int>& indcol, |
| 2080 |
vector<int>& ptr, |
| 2081 |
const bool verbose, |
| 2082 |
FILE *fp); |
| 2083 |
|
| 2084 |
template |
| 2085 |
void DissectionMatrix<complex<double>, double>:: |
| 2086 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2087 |
vector<list<int> > &qparents_index, |
| 2088 |
vector<int> &queue_index, |
| 2089 |
vector<int>& indcol, |
| 2090 |
vector<int>& ptr, |
| 2091 |
const bool verbose, |
| 2092 |
FILE *fp); |
| 2093 |
|
| 2094 |
template |
| 2095 |
void DissectionMatrix<quadruple>:: |
| 2096 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2097 |
vector<list<int> > &qparents_index, |
| 2098 |
vector<int> &queue_index, |
| 2099 |
vector<int>& indcol, |
| 2100 |
vector<int>& ptr, |
| 2101 |
const bool verbose, |
| 2102 |
FILE *fp); |
| 2103 |
|
| 2104 |
template |
| 2105 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 2106 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2107 |
vector<list<int> > &qparents_index, |
| 2108 |
vector<int> &queue_index, |
| 2109 |
vector<int>& indcol, |
| 2110 |
vector<int>& ptr, |
| 2111 |
const bool verbose, |
| 2112 |
FILE *fp); |
| 2113 |
template |
| 2114 |
void DissectionMatrix<float>:: |
| 2115 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2116 |
vector<list<int> > &qparents_index, |
| 2117 |
vector<int> &queue_index, |
| 2118 |
vector<int>& indcol, |
| 2119 |
vector<int>& ptr, |
| 2120 |
const bool verbose, |
| 2121 |
FILE *fp); |
| 2122 |
|
| 2123 |
template |
| 2124 |
void DissectionMatrix<complex<float>, float>:: |
| 2125 |
C_DTRSMScale_rearrange(vector<C_task*> &queue, |
| 2126 |
vector<list<int> > &qparents_index, |
| 2127 |
vector<int> &queue_index, |
| 2128 |
vector<int>& indcol, |
| 2129 |
vector<int>& ptr, |
| 2130 |
const bool verbose, |
| 2131 |
FILE *fp); |
| 2132 |
|
| 2133 |
// |
| 2134 |
|
| 2135 |
template<typename T, typename U> |
| 2136 |
int DissectionMatrix<T, U>::C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2137 |
vector<int> &indcol, |
| 2138 |
RectBlockMatrix<T> *upper1, |
| 2139 |
RectBlockMatrix<T> *lower1, |
| 2140 |
bool isSkip, |
| 2141 |
bool isDirect, |
| 2142 |
SquareBlockMatrix<T>* fdiag, |
| 2143 |
vector<C_task *> &task_p, |
| 2144 |
vector<int> &task_p_index, |
| 2145 |
vector<int> &task_p_indcol, |
| 2146 |
vector<int> &task_p_ptr, |
| 2147 |
vector<C_task *> &task_q, |
| 2148 |
vector<int> &task_q_index, |
| 2149 |
vector<int> &task_q_indcol, |
| 2150 |
vector<int> &task_q_ptr, |
| 2151 |
vector<C_task *> *task_s, |
| 2152 |
const bool verbose, |
| 2153 |
FILE **fp) |
| 2154 |
{ |
| 2155 |
const int nrow = _upper->nbRows(); // _nrow |
| 2156 |
const int nrow1 = isSkip ? (-1) : upper1->nbRows(); // dummy for isSkip |
| 2157 |
|
| 2158 |
const int num_block = _localSchur->num_blocks(); |
| 2159 |
const int num_block0 = _localSchur->num_blocks0(); |
| 2160 |
const int num_block1 = num_block - num_block0; |
| 2161 |
int queue_size; |
| 2162 |
if (nrow == 0 && _level != 0) { |
| 2163 |
queue.resize(1); |
| 2164 |
string task_name = ("f dummy : " + |
| 2165 |
to_string(_level) + " : " +to_string(_nb)); |
| 2166 |
diss_printf(verbose, *fp, |
| 2167 |
"%s %d : %s\n", __FILE__, __LINE__, task_name.c_str()); |
| 2168 |
C_dummy_arg *arg = new C_dummy_arg(verbose, fp, _nb); |
| 2169 |
// *(arg->ops_complexity) = (-1L); |
| 2170 |
queue[0] = new C_task(C_DUMMY, |
| 2171 |
task_name, |
| 2172 |
(void *)arg, |
| 2173 |
C_dummy, |
| 2174 |
1, // atomic_size |
| 2175 |
0, // atomic_id |
| 2176 |
arg->ops_complexity); |
| 2177 |
queue[0]->parents->clear(); |
| 2178 |
return 1; |
| 2179 |
} |
| 2180 |
queue_size = (_isSym ? ((num_block * (num_block + 1)) / 2) : |
| 2181 |
(num_block * num_block)); |
| 2182 |
|
| 2183 |
queue.resize(queue_size); |
| 2184 |
indcol.resize(queue_size); |
| 2185 |
int pncol_block = _upper->num_blocks_c(); // |
| 2186 |
int qncol_block = isSkip ? (-1) : upper1->num_blocks_c(); // |
| 2187 |
|
| 2188 |
int ipos = 0; |
| 2189 |
int parallel_max0, parallel_max1, parallel_max2; |
| 2190 |
parallel_max0 = (_isSym ? (num_block0 * (num_block0 + 1)) / 2 : |
| 2191 |
(num_block0 * num_block0)); |
| 2192 |
parallel_max2 = (_isSym ? (num_block1 * (num_block1 + 1)) / 2 : |
| 2193 |
(num_block1 * num_block1)); |
| 2194 |
parallel_max1 = (_isSym ? (num_block * (num_block + 1)) / 2 : |
| 2195 |
(num_block * num_block)) - parallel_max0 - parallel_max2; |
| 2196 |
for (int j = 0; j < num_block0; j++) { |
| 2197 |
for (int i = 0; i < j; i++) { |
| 2198 |
const long block_nrowl = (long)fdiag->nrowBlock(i, j); |
| 2199 |
const long block_ncoll = (long)fdiag->ncolBlock(i, j); |
| 2200 |
const long nrowl = (long)nrow; |
| 2201 |
const long nrowwl = isSkip ? nrowl : nrowl + (long)nrow1; |
| 2202 |
{ |
| 2203 |
if (isDirect) { |
| 2204 |
const long ops = (isSkip ? 0L : // flag to skip the dependency |
| 2205 |
(block_nrowl * block_ncoll * nrowwl * 2L)); |
| 2206 |
string task_name = ("F " + to_string(i) + " " + to_string(j) |
| 2207 |
+ " : " + to_string(_level) + " : " |
| 2208 |
+ to_string(_nb)); |
| 2209 |
DSchurGEMM_two_arg<T> *arg = |
| 2210 |
new DSchurGEMM_two_arg<T>(_isSym, |
| 2211 |
false, // isTrans |
| 2212 |
_lower, |
| 2213 |
_upper, |
| 2214 |
nrow, |
| 2215 |
lower1, |
| 2216 |
upper1, |
| 2217 |
nrow1, |
| 2218 |
i, |
| 2219 |
j, |
| 2220 |
fdiag, |
| 2221 |
isSkip, |
| 2222 |
verbose, |
| 2223 |
fp, |
| 2224 |
_nb); |
| 2225 |
*(arg->ops_complexity) = ops; |
| 2226 |
queue[ipos] = new C_task(C_DGEMM_DIRECT_TWO, |
| 2227 |
task_name, |
| 2228 |
(void *)arg, |
| 2229 |
DSchurGEMM_offdiag_two<T>, |
| 2230 |
1, // atomic_size |
| 2231 |
0, // atomic_id |
| 2232 |
arg->ops_complexity); |
| 2233 |
queue[ipos]->fp = &(arg->fp); |
| 2234 |
if(!isSkip) { |
| 2235 |
const int mmp = task_p_ptr.size() - 1; |
| 2236 |
const int mmq = task_q_ptr.size() - 1; |
| 2237 |
if (_isSym) { |
| 2238 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2239 |
int nn; |
| 2240 |
nn = task_p_indcol[m] * pncol_block + i; |
| 2241 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2242 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2243 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2244 |
} |
| 2245 |
for (int m = 0; m < task_q_ptr[mmq]; m++) { |
| 2246 |
int nn; |
| 2247 |
nn = task_q_indcol[m] * qncol_block + i; |
| 2248 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2249 |
nn = task_q_indcol[m] * qncol_block + j; |
| 2250 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2251 |
} |
| 2252 |
} |
| 2253 |
else { |
| 2254 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2255 |
int nn; |
| 2256 |
nn = task_p_indcol[2 * m + 1] * pncol_block + i; // lower |
| 2257 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2258 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2259 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2260 |
} |
| 2261 |
for (int m = 0; m < task_q_ptr[mmq]; m++) { |
| 2262 |
int nn; |
| 2263 |
nn = task_q_indcol[2 * m + 1] * qncol_block + i; // lower |
| 2264 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2265 |
nn = task_q_indcol[2 * m] * qncol_block + j; // upper |
| 2266 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2267 |
} |
| 2268 |
} |
| 2269 |
if (task_s != NULL) { |
| 2270 |
const int ktmp = (j * (j + 1)) / 2 + i; // diagonal block DSUB |
| 2271 |
queue[ipos]->parents->push_back((*task_s)[ktmp]); |
| 2272 |
} |
| 2273 |
} // if (!isSkip) |
| 2274 |
} // if (isDirect) |
| 2275 |
else { |
| 2276 |
const long ops = (isSkip ? 0L : // flag to skip the dependency |
| 2277 |
(block_nrowl * block_ncoll * nrowl * 2L)); |
| 2278 |
string task_name = ("f " + to_string(i) + " " + to_string(j) |
| 2279 |
+ " : " + to_string(_level) + " : " |
| 2280 |
+ to_string(_nb)); |
| 2281 |
DSchurGEMM_arg<T> *arg = |
| 2282 |
new DSchurGEMM_arg<T>(_isSym, |
| 2283 |
false, // isTrans |
| 2284 |
_lower, |
| 2285 |
_upper, |
| 2286 |
nrow, |
| 2287 |
i, |
| 2288 |
j, |
| 2289 |
_localSchur, |
| 2290 |
verbose, |
| 2291 |
fp, |
| 2292 |
_nb); |
| 2293 |
*(arg->ops_complexity) = ops; |
| 2294 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_TWO, |
| 2295 |
task_name, |
| 2296 |
(void *)arg, |
| 2297 |
DSchurGEMM_offdiag<T>, |
| 2298 |
1, // atomic_size |
| 2299 |
0, // atomic_id |
| 2300 |
arg->ops_complexity); |
| 2301 |
queue[ipos]->fp = &(arg->fp); |
| 2302 |
const int mmp = task_p_ptr.size() - 1; |
| 2303 |
if (_isSym) { |
| 2304 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2305 |
int nn; |
| 2306 |
nn = task_p_indcol[m] * pncol_block + i; // lower |
| 2307 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2308 |
nn = task_p_indcol[m] * pncol_block + j; // upper |
| 2309 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2310 |
} |
| 2311 |
} |
| 2312 |
else { |
| 2313 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2314 |
int nn; |
| 2315 |
nn = task_p_indcol[2 * m + 1] * pncol_block + i; // lower |
| 2316 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2317 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2318 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2319 |
} |
| 2320 |
} |
| 2321 |
} // else if (isDirect) |
| 2322 |
queue[ipos]->parents->unique(); |
| 2323 |
queue[ipos]->parallel_max = parallel_max0; |
| 2324 |
queue[ipos]->parallel_id = ipos; |
| 2325 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + i) : (j * j + 2 * i); |
| 2326 |
indcol[itmp] = ipos; |
| 2327 |
ipos++; // lower block |
| 2328 |
} |
| 2329 |
if (!_isSym) { |
| 2330 |
if (isDirect) { |
| 2331 |
const long ops = (isSkip ? 0L : // flag to skip the dependency |
| 2332 |
(block_nrowl * block_ncoll * nrowwl * 2L)); |
| 2333 |
string task_name = ("F " + to_string(j) + " " + to_string(i) |
| 2334 |
+ " : " + to_string(_level) + " : " |
| 2335 |
+ to_string(_nb)); |
| 2336 |
DSchurGEMM_two_arg<T> *arg = |
| 2337 |
new DSchurGEMM_two_arg<T>(_isSym, |
| 2338 |
true, // isTrans |
| 2339 |
_upper, |
| 2340 |
_lower, |
| 2341 |
nrow, |
| 2342 |
upper1, |
| 2343 |
lower1, |
| 2344 |
nrow1, |
| 2345 |
j, // transposed |
| 2346 |
i, |
| 2347 |
fdiag, |
| 2348 |
isSkip, // |
| 2349 |
verbose, |
| 2350 |
fp, |
| 2351 |
_nb); |
| 2352 |
*(arg->ops_complexity) = ops; |
| 2353 |
queue[ipos] = new C_task(C_DGEMM_DIRECT_TWO, |
| 2354 |
task_name, |
| 2355 |
(void *)arg, |
| 2356 |
DSchurGEMM_offdiag_two<T>, |
| 2357 |
1, |
| 2358 |
0, |
| 2359 |
arg->ops_complexity); |
| 2360 |
queue[ipos]->fp = &(arg->fp); |
| 2361 |
if(!isSkip) { |
| 2362 |
for (int m = 0; m < (task_p_ptr.size() - 1); m++) { |
| 2363 |
int mm, nn; |
| 2364 |
mm = 2 * task_p_ptr[m]; // upper |
| 2365 |
nn = task_p_indcol[mm] * pncol_block + i; |
| 2366 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2367 |
mm = 2 * task_p_ptr[m] + 1; // lower |
| 2368 |
nn = task_p_indcol[mm] * pncol_block + j; |
| 2369 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2370 |
} |
| 2371 |
for (int m = 0; m < (task_q_ptr.size() - 1); m++) { |
| 2372 |
int mm, nn; |
| 2373 |
mm = 2 * task_q_ptr[m]; // upper |
| 2374 |
nn = task_q_indcol[mm] * qncol_block + i; |
| 2375 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2376 |
mm = 2 * task_q_ptr[m] + 1; // lower |
| 2377 |
nn = task_q_indcol[mm] * qncol_block + j; |
| 2378 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2379 |
} |
| 2380 |
if (task_s != NULL) { |
| 2381 |
const int ktmp = (j * (j + 1)) / 2 + i; // diagonal block DSUB |
| 2382 |
queue[ipos]->parents->push_back((*task_s)[ktmp]); |
| 2383 |
} |
| 2384 |
} |
| 2385 |
} // if (isDirect) |
| 2386 |
else { |
| 2387 |
const long ops = (isSkip ? 0L : // flag to skip the dependency |
| 2388 |
(block_nrowl * block_ncoll * nrowl * 2L)); |
| 2389 |
string task_name = ("f " + to_string(j) + " " + to_string(i) |
| 2390 |
+ " : " + to_string(_level) + " : " |
| 2391 |
+ to_string(_nb)); |
| 2392 |
DSchurGEMM_arg<T> *arg = |
| 2393 |
new DSchurGEMM_arg<T>(_isSym, |
| 2394 |
true, // isTrans |
| 2395 |
_upper, |
| 2396 |
_lower, |
| 2397 |
nrow, |
| 2398 |
j, // trasnposed |
| 2399 |
i, |
| 2400 |
_localSchur, |
| 2401 |
verbose, |
| 2402 |
fp, |
| 2403 |
_nb); |
| 2404 |
*(arg->ops_complexity) = ops; |
| 2405 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_TWO, |
| 2406 |
task_name, |
| 2407 |
(void *)arg, |
| 2408 |
DSchurGEMM_offdiag<T>, |
| 2409 |
1, |
| 2410 |
0, |
| 2411 |
arg->ops_complexity); |
| 2412 |
queue[ipos]->fp = &(arg->fp); |
| 2413 |
const int mmp = task_p_ptr.size() - 1; |
| 2414 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2415 |
int nn; |
| 2416 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2417 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2418 |
nn = task_p_indcol[2 * m] * pncol_block + i; // upper |
| 2419 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2420 |
} |
| 2421 |
} // else if (isDirect) |
| 2422 |
queue[ipos]->parents->unique(); |
| 2423 |
queue[ipos]->parallel_max = parallel_max0; |
| 2424 |
queue[ipos]->parallel_id = ipos; |
| 2425 |
const int itmp = j * j + 2 * i + 1; // lower part of unsymmetric matrix |
| 2426 |
indcol[itmp] = ipos; |
| 2427 |
ipos++; |
| 2428 |
} // (!_isSym) |
| 2429 |
} // loop : i |
| 2430 |
// diagonal |
| 2431 |
{ |
| 2432 |
const long block_ncoll = (long)fdiag->ncolBlock(j, j); |
| 2433 |
const long nrowl = (long)nrow; |
| 2434 |
const long nrowwl = isSkip ? nrowl : nrowl + (long)nrow1; |
| 2435 |
if (isDirect) { |
| 2436 |
const long ops = (isSkip ? 0L : |
| 2437 |
(_isSym ? (block_ncoll * (block_ncoll + 1L) * nrowwl) : |
| 2438 |
(block_ncoll * block_ncoll * nrowwl * 2L))); |
| 2439 |
string task_name = ("F " + to_string(j) + " " + to_string(j) |
| 2440 |
+ " : " + to_string(_level) + " : " |
| 2441 |
+ to_string(_nb)); |
| 2442 |
DSchurGEMM_two_arg<T> *arg = |
| 2443 |
new DSchurGEMM_two_arg<T>(_isSym, |
| 2444 |
false, // |
| 2445 |
_lower, // |
| 2446 |
_upper, // |
| 2447 |
nrow, |
| 2448 |
lower1, // |
| 2449 |
upper1, // |
| 2450 |
nrow1, |
| 2451 |
j, |
| 2452 |
(-1), |
| 2453 |
fdiag, |
| 2454 |
isSkip, |
| 2455 |
verbose, |
| 2456 |
fp, |
| 2457 |
_nb); |
| 2458 |
*(arg->ops_complexity) = ops; |
| 2459 |
queue[ipos] = new C_task(C_DGEMM_DIRECT_TWO, |
| 2460 |
task_name, // task_name_cstr, |
| 2461 |
(void *)arg, |
| 2462 |
DSchurGEMM_diag_two<T>, |
| 2463 |
1, // atomic_size |
| 2464 |
0, // atomic_id |
| 2465 |
arg->ops_complexity); |
| 2466 |
queue[ipos]->fp = &(arg->fp); |
| 2467 |
if(!isSkip) { |
| 2468 |
const int mmp = task_p_ptr.size() - 1; |
| 2469 |
const int mmq = task_q_ptr.size() - 1; |
| 2470 |
if (_isSym) { |
| 2471 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2472 |
int nn; |
| 2473 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2474 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2475 |
} |
| 2476 |
for (int m = 0; m < task_q_ptr[mmq]; m++) { |
| 2477 |
int nn; |
| 2478 |
nn = task_q_indcol[m] * qncol_block + j; |
| 2479 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2480 |
} |
| 2481 |
} |
| 2482 |
else { |
| 2483 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2484 |
int nn; |
| 2485 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2486 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2487 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2488 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2489 |
} |
| 2490 |
for (int m = 0; m < task_q_ptr[mmq]; m++) { |
| 2491 |
int nn; |
| 2492 |
nn = task_q_indcol[2 * m + 1] * qncol_block + j; // lower |
| 2493 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2494 |
nn = task_q_indcol[2 * m] * qncol_block + j; // upper |
| 2495 |
queue[ipos]->parents->push_back(task_q[task_q_index[nn]]); |
| 2496 |
} |
| 2497 |
} |
| 2498 |
if (task_s != NULL) { |
| 2499 |
const int ktmp = (j * (j + 1)) / 2 + j; // diagonal block DSUB |
| 2500 |
queue[ipos]->parents->push_back((*task_s)[ktmp]); |
| 2501 |
} |
| 2502 |
} |
| 2503 |
} // if (isDirect) |
| 2504 |
else { |
| 2505 |
const long ops = (isSkip ? 0L : |
| 2506 |
(_isSym ? (block_ncoll * (block_ncoll + 1L) * nrowl) : |
| 2507 |
(block_ncoll * block_ncoll * nrowl * 2L))); |
| 2508 |
string task_name = ("f " + to_string(j) + " " + to_string(j) |
| 2509 |
+ " : " + to_string(_level) + " : " |
| 2510 |
+ to_string(_nb)); |
| 2511 |
DSchurGEMM_arg<T> *arg = |
| 2512 |
new DSchurGEMM_arg<T>(_isSym, |
| 2513 |
false, // isTrans |
| 2514 |
_lower, // |
| 2515 |
_upper, // |
| 2516 |
nrow, |
| 2517 |
j, |
| 2518 |
(-1), |
| 2519 |
_localSchur, |
| 2520 |
verbose, |
| 2521 |
fp, |
| 2522 |
_nb); |
| 2523 |
*(arg->ops_complexity) = ops; |
| 2524 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_TWO, |
| 2525 |
task_name, // task_name_cstr, |
| 2526 |
(void *)arg, |
| 2527 |
DSchurGEMM_diag<T>, |
| 2528 |
1, // atomic_size |
| 2529 |
0, // atomic_id |
| 2530 |
arg->ops_complexity); |
| 2531 |
queue[ipos]->fp = &(arg->fp); |
| 2532 |
const int mmp = task_p_ptr.size() - 1; |
| 2533 |
if (_isSym) { |
| 2534 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2535 |
int nn; |
| 2536 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2537 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2538 |
} |
| 2539 |
} |
| 2540 |
else { |
| 2541 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2542 |
int nn; |
| 2543 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2544 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2545 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2546 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2547 |
} |
| 2548 |
} |
| 2549 |
} // else if (isDirect) |
| 2550 |
queue[ipos]->parents->unique(); |
| 2551 |
queue[ipos]->parallel_max = parallel_max0; |
| 2552 |
queue[ipos]->parallel_id = ipos; |
| 2553 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + j) : (j * j + 2 * j); |
| 2554 |
indcol[itmp] = ipos; |
| 2555 |
ipos++; |
| 2556 |
} |
| 2557 |
} // loop : j |
| 2558 |
for (int j = num_block0; j < num_block; j++) { |
| 2559 |
for (int i = 0; i < num_block0; i++) { |
| 2560 |
const long block_nrowl = (long)_localSchur->nrowBlock(i, j); |
| 2561 |
const long block_ncoll = (long)_localSchur->ncolBlock(i, j); |
| 2562 |
const long nrowl = (long)nrow; |
| 2563 |
{ |
| 2564 |
const long ops = block_nrowl * block_ncoll * nrowl * 2L; |
| 2565 |
string task_name = ("f " + to_string(i) + " " + to_string(j) |
| 2566 |
+ " : " + to_string(_level) + " : " |
| 2567 |
+ to_string(_nb)); |
| 2568 |
DSchurGEMM_arg<T> *arg = |
| 2569 |
new DSchurGEMM_arg<T>(_isSym, |
| 2570 |
false, // isTrans |
| 2571 |
_lower, |
| 2572 |
_upper, |
| 2573 |
nrow, |
| 2574 |
i, //(i * SIZE_B1), |
| 2575 |
j, //(j * SIZE_B1), |
| 2576 |
_localSchur, |
| 2577 |
verbose, |
| 2578 |
fp, |
| 2579 |
_nb); |
| 2580 |
*(arg->ops_complexity) = ops; |
| 2581 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_TWO, |
| 2582 |
task_name, |
| 2583 |
(void *)arg, |
| 2584 |
DSchurGEMM_offdiag<T>, |
| 2585 |
1, // atomic_size |
| 2586 |
0, // atomic_id |
| 2587 |
arg->ops_complexity); |
| 2588 |
queue[ipos]->fp = &(arg->fp); |
| 2589 |
const int mmp = task_p_ptr.size() - 1; |
| 2590 |
if (_isSym) { |
| 2591 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2592 |
int nn; |
| 2593 |
nn = task_p_indcol[m] * pncol_block + i; |
| 2594 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2595 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2596 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2597 |
} |
| 2598 |
} |
| 2599 |
else { |
| 2600 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2601 |
int nn; |
| 2602 |
nn = task_p_indcol[2 * m + 1] * pncol_block + i; // lower |
| 2603 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2604 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2605 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2606 |
} |
| 2607 |
} |
| 2608 |
queue[ipos]->parents->sort(compare_task_name); |
| 2609 |
queue[ipos]->parents->unique(); |
| 2610 |
queue[ipos]->parallel_max = parallel_max1; |
| 2611 |
queue[ipos]->parallel_id = ipos - parallel_max0; |
| 2612 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + i) : (j * j + 2 * i); |
| 2613 |
indcol[itmp] = ipos; |
| 2614 |
ipos++; // lower block |
| 2615 |
} |
| 2616 |
if (!_isSym) { |
| 2617 |
const long ops = block_nrowl * block_ncoll * nrowl * 2L; |
| 2618 |
string task_name = ("f " + to_string(j) + " " + to_string(i) |
| 2619 |
+ " : " + to_string(_level) + " : " |
| 2620 |
+ to_string(_nb)); |
| 2621 |
DSchurGEMM_arg<T> *arg = |
| 2622 |
new DSchurGEMM_arg<T>(_isSym, |
| 2623 |
true, // isTrans |
| 2624 |
_upper, |
| 2625 |
_lower, |
| 2626 |
nrow, |
| 2627 |
j, // transposed |
| 2628 |
i, |
| 2629 |
_localSchur, |
| 2630 |
verbose, |
| 2631 |
fp, |
| 2632 |
_nb); |
| 2633 |
*(arg->ops_complexity) = ops; |
| 2634 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_TWO, |
| 2635 |
task_name, |
| 2636 |
(void *)arg, |
| 2637 |
DSchurGEMM_offdiag<T>, |
| 2638 |
1, // atomic_size |
| 2639 |
0, // atomic_id |
| 2640 |
arg->ops_complexity); |
| 2641 |
queue[ipos]->fp = &(arg->fp); |
| 2642 |
const int mmp = task_p_ptr.size() - 1; |
| 2643 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2644 |
int nn; |
| 2645 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2646 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2647 |
nn = task_p_indcol[2 * m] * pncol_block + i; // upper |
| 2648 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2649 |
} |
| 2650 |
queue[ipos]->parents->sort(compare_task_name); |
| 2651 |
queue[ipos]->parents->unique(); |
| 2652 |
queue[ipos]->parallel_max = parallel_max1; |
| 2653 |
queue[ipos]->parallel_id = ipos - parallel_max0; |
| 2654 |
const int itmp = j * j + 2 * i + 1; |
| 2655 |
indcol[itmp] = ipos; |
| 2656 |
ipos++; |
| 2657 |
} // (!_isSym) |
| 2658 |
} // loop : i |
| 2659 |
} |
| 2660 |
for (int j = num_block0; j < num_block; j++) { |
| 2661 |
for (int i = num_block0; i < j; i++) { |
| 2662 |
const long block_nrowl = (long)_localSchur->nrowBlock(i, j); |
| 2663 |
const long block_ncoll = (long)_localSchur->ncolBlock(i, j); |
| 2664 |
const long nrowl = (long)nrow; |
| 2665 |
{ |
| 2666 |
const long ops = block_nrowl * block_ncoll * nrowl * 2L; |
| 2667 |
string task_name = ("f " + to_string(i) + " " + to_string(j) |
| 2668 |
+ " : " + to_string(_level) + " : " |
| 2669 |
+ to_string(_nb)); |
| 2670 |
DSchurGEMM_arg<T> *arg = |
| 2671 |
new DSchurGEMM_arg<T>(_isSym, |
| 2672 |
false, // isTrans |
| 2673 |
_lower, |
| 2674 |
_upper, |
| 2675 |
nrow, |
| 2676 |
i, //(i * SIZE_B1), |
| 2677 |
j, //(j * SIZE_B1), |
| 2678 |
_localSchur, |
| 2679 |
verbose, |
| 2680 |
fp, |
| 2681 |
_nb); |
| 2682 |
*(arg->ops_complexity) = ops; |
| 2683 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_MULT, |
| 2684 |
task_name, |
| 2685 |
(void *)arg, |
| 2686 |
DSchurGEMM_offdiag<T>, |
| 2687 |
1, // atomic_size |
| 2688 |
0, // atomic_id |
| 2689 |
arg->ops_complexity); |
| 2690 |
queue[ipos]->fp = &(arg->fp); |
| 2691 |
const int mmp = task_p_ptr.size() - 1; |
| 2692 |
if (_isSym) { |
| 2693 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2694 |
int nn; |
| 2695 |
nn = task_p_indcol[m] * pncol_block + i; |
| 2696 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2697 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2698 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2699 |
} |
| 2700 |
} |
| 2701 |
else { |
| 2702 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2703 |
int nn; |
| 2704 |
nn = task_p_indcol[2 * m + 1] * pncol_block + i; // lower |
| 2705 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2706 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2707 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2708 |
} |
| 2709 |
} |
| 2710 |
queue[ipos]->parents->sort(compare_task_name); |
| 2711 |
queue[ipos]->parents->unique(); |
| 2712 |
queue[ipos]->parallel_max = parallel_max2; |
| 2713 |
queue[ipos]->parallel_id = ipos - parallel_max0 - parallel_max1; |
| 2714 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + i) : (j * j + 2 * i); |
| 2715 |
indcol[itmp] = ipos; |
| 2716 |
ipos++; // lower block |
| 2717 |
} |
| 2718 |
if (!_isSym) { |
| 2719 |
const long ops = block_nrowl * block_ncoll * nrowl * 2L; |
| 2720 |
string task_name = ("f " + to_string(j) + " " + to_string(i) |
| 2721 |
+ " : " + to_string(_level) + " : " |
| 2722 |
+ to_string(_nb)); |
| 2723 |
DSchurGEMM_arg<T> *arg = |
| 2724 |
new DSchurGEMM_arg<T>(_isSym, |
| 2725 |
true, // isTrans |
| 2726 |
_upper, |
| 2727 |
_lower, |
| 2728 |
nrow, |
| 2729 |
j, // transposed |
| 2730 |
i, |
| 2731 |
_localSchur, |
| 2732 |
verbose, |
| 2733 |
fp, |
| 2734 |
_nb); |
| 2735 |
*(arg->ops_complexity) = ops; |
| 2736 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_MULT, |
| 2737 |
task_name, |
| 2738 |
(void *)arg, |
| 2739 |
DSchurGEMM_offdiag<T>, |
| 2740 |
1, // atomic_size |
| 2741 |
0, // atomic_id |
| 2742 |
arg->ops_complexity); |
| 2743 |
queue[ipos]->fp = &(arg->fp); |
| 2744 |
const int mmp = task_p_ptr.size() - 1; |
| 2745 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2746 |
int nn; |
| 2747 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2748 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2749 |
nn = task_p_indcol[2 * m] * pncol_block + i; // upper |
| 2750 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2751 |
} |
| 2752 |
queue[ipos]->parents->sort(compare_task_name); |
| 2753 |
queue[ipos]->parents->unique(); |
| 2754 |
queue[ipos]->parallel_max = parallel_max2; |
| 2755 |
queue[ipos]->parallel_id = ipos - parallel_max0 - parallel_max1; |
| 2756 |
const int itmp = j * j + 2 * i + 1; |
| 2757 |
indcol[itmp] = ipos; |
| 2758 |
ipos++; |
| 2759 |
} // (!_isSym) |
| 2760 |
} // loop : i |
| 2761 |
|
| 2762 |
// diagonal |
| 2763 |
{ |
| 2764 |
string task_name = ("f " + to_string(j) + " " + to_string(j) |
| 2765 |
+ " : " + to_string(_level) + " : " |
| 2766 |
+ to_string(_nb)); |
| 2767 |
const long nrowl = (long)nrow; |
| 2768 |
const long block_ncoll = (long)_localSchur->ncolBlock(j, j); |
| 2769 |
const long ops = (_isSym ? |
| 2770 |
(block_ncoll * (block_ncoll + 1L) * nrowl) : |
| 2771 |
(block_ncoll * block_ncoll * nrowl * 2L)); |
| 2772 |
DSchurGEMM_arg<T> *arg = |
| 2773 |
new DSchurGEMM_arg<T>(_isSym, |
| 2774 |
false, // isTrans |
| 2775 |
_lower, // |
| 2776 |
_upper, // |
| 2777 |
nrow, |
| 2778 |
j, //(j * SIZE_B1), |
| 2779 |
(-1), |
| 2780 |
_localSchur, |
| 2781 |
verbose, |
| 2782 |
fp, |
| 2783 |
_nb); |
| 2784 |
*(arg->ops_complexity) = ops; |
| 2785 |
queue[ipos] = new C_task(C_DGEMM_LOCAL_MULT, |
| 2786 |
task_name, // task_name_cstr, |
| 2787 |
(void *)arg, |
| 2788 |
DSchurGEMM_diag<T>, |
| 2789 |
1, // atomic_size |
| 2790 |
0, // atomic_id |
| 2791 |
arg->ops_complexity); |
| 2792 |
queue[ipos]->fp = &(arg->fp); |
| 2793 |
const int mmp = task_p_ptr.size() - 1; |
| 2794 |
if (_isSym) { |
| 2795 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2796 |
int nn; |
| 2797 |
nn = task_p_indcol[m] * pncol_block + j; |
| 2798 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2799 |
} |
| 2800 |
} |
| 2801 |
else { |
| 2802 |
for (int m = 0; m < task_p_ptr[mmp]; m++) { |
| 2803 |
int nn; |
| 2804 |
nn = task_p_indcol[2 * m + 1] * pncol_block + j; // lower |
| 2805 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2806 |
nn = task_p_indcol[2 * m] * pncol_block + j; // upper |
| 2807 |
queue[ipos]->parents->push_back(task_p[task_p_index[nn]]); |
| 2808 |
} |
| 2809 |
} |
| 2810 |
queue[ipos]->parents->sort(compare_task_name); |
| 2811 |
queue[ipos]->parents->unique(); |
| 2812 |
queue[ipos]->parallel_max = parallel_max2; |
| 2813 |
queue[ipos]->parallel_id = ipos - parallel_max0 - parallel_max1; |
| 2814 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + j) : (j * j + 2 * j); |
| 2815 |
indcol[itmp] = ipos; |
| 2816 |
ipos++; |
| 2817 |
} |
| 2818 |
} // loop : j |
| 2819 |
return queue.size(); |
| 2820 |
} |
| 2821 |
|
| 2822 |
template |
| 2823 |
int DissectionMatrix<double>:: |
| 2824 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2825 |
vector<int> &indcol, |
| 2826 |
RectBlockMatrix<double> *upper1, |
| 2827 |
RectBlockMatrix<double> *lower1, |
| 2828 |
bool isSkip, |
| 2829 |
bool isDirect, |
| 2830 |
SquareBlockMatrix<double>* fdiag, |
| 2831 |
vector<C_task *> &task_p, |
| 2832 |
vector<int> &task_p_index, |
| 2833 |
vector<int> &task_p_indcol, |
| 2834 |
vector<int> &task_p_ptr, |
| 2835 |
vector<C_task *> &task_q, |
| 2836 |
vector<int> &task_q_index, |
| 2837 |
vector<int> &task_q_indcol, |
| 2838 |
vector<int> &task_q_ptr, |
| 2839 |
vector<C_task *> *task_s, |
| 2840 |
const bool verbose, |
| 2841 |
FILE **fp); |
| 2842 |
|
| 2843 |
template |
| 2844 |
int DissectionMatrix<complex<double>, double>:: |
| 2845 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2846 |
vector<int> &indcol, |
| 2847 |
RectBlockMatrix<complex<double> > *upper1, |
| 2848 |
RectBlockMatrix<complex<double> > *lower1, |
| 2849 |
bool isSkip, |
| 2850 |
bool isDirect, |
| 2851 |
SquareBlockMatrix<complex<double> > *fdiag, |
| 2852 |
vector<C_task *> &task_p, |
| 2853 |
vector<int> &task_p_index, |
| 2854 |
vector<int> &task_p_indcol, |
| 2855 |
vector<int> &task_p_ptr, |
| 2856 |
vector<C_task *> &task_q, |
| 2857 |
vector<int> &task_q_index, |
| 2858 |
vector<int> &task_q_indcol, |
| 2859 |
vector<int> &task_q_ptr, |
| 2860 |
vector<C_task *> *task_s, |
| 2861 |
const bool verbose, |
| 2862 |
FILE **fp); |
| 2863 |
|
| 2864 |
template |
| 2865 |
int DissectionMatrix<quadruple>:: |
| 2866 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2867 |
vector<int> &indcol, |
| 2868 |
RectBlockMatrix<quadruple> *upper1, |
| 2869 |
RectBlockMatrix<quadruple> *lower1, |
| 2870 |
bool isSkip, |
| 2871 |
bool isDirect, |
| 2872 |
SquareBlockMatrix<quadruple>* fdiag, |
| 2873 |
vector<C_task *> &task_p, |
| 2874 |
vector<int> &task_p_index, |
| 2875 |
vector<int> &task_p_indcol, |
| 2876 |
vector<int> &task_p_ptr, |
| 2877 |
vector<C_task *> &task_q, |
| 2878 |
vector<int> &task_q_index, |
| 2879 |
vector<int> &task_q_indcol, |
| 2880 |
vector<int> &task_q_ptr, |
| 2881 |
vector<C_task *> *task_s, |
| 2882 |
const bool verbose, |
| 2883 |
FILE **fp); |
| 2884 |
|
| 2885 |
template |
| 2886 |
int DissectionMatrix<complex<quadruple>, quadruple>:: |
| 2887 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2888 |
vector<int> &indcol, |
| 2889 |
RectBlockMatrix<complex<quadruple> > *upper1, |
| 2890 |
RectBlockMatrix<complex<quadruple> > *lower1, |
| 2891 |
bool isSkip, |
| 2892 |
bool isDirect, |
| 2893 |
SquareBlockMatrix<complex<quadruple> > *fdiag, |
| 2894 |
vector<C_task *> &task_p, |
| 2895 |
vector<int> &task_p_index, |
| 2896 |
vector<int> &task_p_indcol, |
| 2897 |
vector<int> &task_p_ptr, |
| 2898 |
vector<C_task *> &task_q, |
| 2899 |
vector<int> &task_q_index, |
| 2900 |
vector<int> &task_q_indcol, |
| 2901 |
vector<int> &task_q_ptr, |
| 2902 |
vector<C_task *> *task_s, |
| 2903 |
const bool verbose, |
| 2904 |
FILE **fp); |
| 2905 |
|
| 2906 |
template |
| 2907 |
int DissectionMatrix<float>:: |
| 2908 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2909 |
vector<int> &indcol, |
| 2910 |
RectBlockMatrix<float> *upper1, |
| 2911 |
RectBlockMatrix<float> *lower1, |
| 2912 |
bool isSkip, |
| 2913 |
bool isDirect, |
| 2914 |
SquareBlockMatrix<float>* fdiag, |
| 2915 |
vector<C_task *> &task_p, |
| 2916 |
vector<int> &task_p_index, |
| 2917 |
vector<int> &task_p_indcol, |
| 2918 |
vector<int> &task_p_ptr, |
| 2919 |
vector<C_task *> &task_q, |
| 2920 |
vector<int> &task_q_index, |
| 2921 |
vector<int> &task_q_indcol, |
| 2922 |
vector<int> &task_q_ptr, |
| 2923 |
vector<C_task *> *task_s, |
| 2924 |
const bool verbose, |
| 2925 |
FILE **fp); |
| 2926 |
|
| 2927 |
template |
| 2928 |
int DissectionMatrix<complex<float>, float>:: |
| 2929 |
C_DGEMM_local_queue(vector<C_task*> &queue, |
| 2930 |
vector<int> &indcol, |
| 2931 |
RectBlockMatrix<complex<float> > *upper1, |
| 2932 |
RectBlockMatrix<complex<float> > *lower1, |
| 2933 |
bool isSkip, |
| 2934 |
bool isDirect, |
| 2935 |
SquareBlockMatrix<complex<float> > *fdiag, |
| 2936 |
vector<C_task *> &task_p, |
| 2937 |
vector<int> &task_p_index, |
| 2938 |
vector<int> &task_p_indcol, |
| 2939 |
vector<int> &task_p_ptr, |
| 2940 |
vector<C_task *> &task_q, |
| 2941 |
vector<int> &task_q_index, |
| 2942 |
vector<int> &task_q_indcol, |
| 2943 |
vector<int> &task_q_ptr, |
| 2944 |
vector<C_task *> *task_s, |
| 2945 |
const bool verbose, |
| 2946 |
FILE **fp); |
| 2947 |
// |
| 2948 |
|
| 2949 |
template<typename T, typename U> |
| 2950 |
void DissectionMatrix<T, U>::C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 2951 |
vector<int> &indcol, |
| 2952 |
const bool verbose, |
| 2953 |
FILE **fp) |
| 2954 |
{ |
| 2955 |
const int num_block = _localSchur->num_blocks(); |
| 2956 |
const int num_block0 = _localSchur->num_blocks0(); |
| 2957 |
const int num_block1 = num_block - num_block0; |
| 2958 |
int sizeq; |
| 2959 |
sizeq = (_isSym ? |
| 2960 |
(num_block0 * num_block1 + (num_block1 * (num_block1 + 1)) / 2) : |
| 2961 |
(num_block0 * num_block1 * 2 + num_block1 * num_block1)); |
| 2962 |
|
| 2963 |
queue.resize(sizeq); |
| 2964 |
|
| 2965 |
sizeq = (_isSym ? |
| 2966 |
(num_block * (num_block + 1) / 2) : (num_block * num_block)); |
| 2967 |
|
| 2968 |
indcol.resize(sizeq); |
| 2969 |
|
| 2970 |
int ipos = 0; |
| 2971 |
for (int j = num_block0; j < num_block; j++) { |
| 2972 |
for (int i = 0; i < num_block0; i++) { |
| 2973 |
{ |
| 2974 |
string task_name = ("m " + to_string(i) + " " + to_string(j) |
| 2975 |
+ " : " + to_string(_level) + " : " |
| 2976 |
+ to_string(_nb)); |
| 2977 |
const long nrow = (long)_localSchur->nrowBlock(i, j); |
| 2978 |
const long ncol = (long)_localSchur->ncolBlock(i, j); |
| 2979 |
const long ops = nrow * ncol; |
| 2980 |
C_deallocLocalSchur_arg<T> *arg = |
| 2981 |
new C_deallocLocalSchur_arg<T>(_isSym, |
| 2982 |
_localSchur, |
| 2983 |
i, |
| 2984 |
j, |
| 2985 |
verbose, |
| 2986 |
fp, |
| 2987 |
_nb); |
| 2988 |
*(arg->ops_complexity) = ops; |
| 2989 |
queue[ipos] = new C_task(C_DEALLOCLOCALSCHUR, |
| 2990 |
task_name, |
| 2991 |
(void *)arg, |
| 2992 |
C_deallocLocalSchur<T>, |
| 2993 |
1, // atomic_size |
| 2994 |
0, // atomic_id |
| 2995 |
arg->ops_complexity); |
| 2996 |
queue[ipos]->fp = &(arg->fp); |
| 2997 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + i) : (j * j + 2 * i); |
| 2998 |
indcol[itmp] = ipos; |
| 2999 |
ipos++; // lower block |
| 3000 |
} |
| 3001 |
if (!_isSym) { |
| 3002 |
string task_name = ("m " + to_string(j) + " " + to_string(i) |
| 3003 |
+ " : " + to_string(_level) + " : " |
| 3004 |
+ to_string(_nb)); |
| 3005 |
const long ops = 1L; // dummy |
| 3006 |
C_deallocLocalSchur_arg<T> *arg = |
| 3007 |
new C_deallocLocalSchur_arg<T>(_isSym, |
| 3008 |
_localSchur, |
| 3009 |
j, |
| 3010 |
i, |
| 3011 |
verbose, |
| 3012 |
fp, |
| 3013 |
_nb); |
| 3014 |
*(arg->ops_complexity) = ops; |
| 3015 |
queue[ipos] = new C_task(C_DEALLOCLOCALSCHUR, |
| 3016 |
task_name, |
| 3017 |
(void *)arg, |
| 3018 |
C_deallocLocalSchur<T>, |
| 3019 |
1, // atomic_size |
| 3020 |
0, // atomic_id |
| 3021 |
arg->ops_complexity); |
| 3022 |
queue[ipos]->fp = &(arg->fp); |
| 3023 |
const int itmp = j * j + 2 * i + 1; |
| 3024 |
indcol[itmp] = ipos; |
| 3025 |
ipos++; |
| 3026 |
} // (!_isSym) |
| 3027 |
} // loop : i |
| 3028 |
} |
| 3029 |
for (int j = num_block0; j < num_block; j++) { |
| 3030 |
for (int i = num_block0; i < j; i++) { |
| 3031 |
{ |
| 3032 |
string task_name = ("m " + to_string(i) + " " + to_string(j) |
| 3033 |
+ " : " + to_string(_level) + " : " |
| 3034 |
+ to_string(_nb)); |
| 3035 |
const long nrow = (long)_localSchur->nrowBlock(i, j); |
| 3036 |
const long ncol = (long)_localSchur->ncolBlock(i, j); |
| 3037 |
const long ops = nrow * ncol; |
| 3038 |
C_deallocLocalSchur_arg<T> *arg = |
| 3039 |
new C_deallocLocalSchur_arg<T>(_isSym, |
| 3040 |
_localSchur, |
| 3041 |
i, |
| 3042 |
j, |
| 3043 |
verbose, |
| 3044 |
fp, |
| 3045 |
_nb); |
| 3046 |
*(arg->ops_complexity) = ops; |
| 3047 |
queue[ipos] = new C_task(C_DEALLOCLOCALSCHUR, |
| 3048 |
task_name, |
| 3049 |
(void *)arg, |
| 3050 |
C_deallocLocalSchur<T>, |
| 3051 |
1, // atomic_size |
| 3052 |
0, // atomic_id |
| 3053 |
arg->ops_complexity); |
| 3054 |
queue[ipos]->fp = &(arg->fp); |
| 3055 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + i) : (j * j + 2 * i); |
| 3056 |
indcol[itmp] = ipos; |
| 3057 |
ipos++; // lower block |
| 3058 |
} |
| 3059 |
if (!_isSym) { |
| 3060 |
string task_name = ("m " + to_string(j) + " " + to_string(i) |
| 3061 |
+ " : " + to_string(_level) + " : " |
| 3062 |
+ to_string(_nb)); |
| 3063 |
const long nrow = (long)_localSchur->nrowBlock(i, j); |
| 3064 |
const long ncol = (long)_localSchur->ncolBlock(i, j); |
| 3065 |
const long ops = nrow * ncol; // dummy |
| 3066 |
C_deallocLocalSchur_arg<T> *arg = |
| 3067 |
new C_deallocLocalSchur_arg<T>(_isSym, |
| 3068 |
_localSchur, |
| 3069 |
j, |
| 3070 |
i, |
| 3071 |
verbose, |
| 3072 |
fp, |
| 3073 |
_nb); |
| 3074 |
*(arg->ops_complexity) = ops; |
| 3075 |
queue[ipos] = new C_task(C_DEALLOCLOCALSCHUR, |
| 3076 |
task_name, |
| 3077 |
(void *)arg, |
| 3078 |
C_deallocLocalSchur<T>, |
| 3079 |
1, // atomic_size |
| 3080 |
0, // atomic_id |
| 3081 |
arg->ops_complexity); |
| 3082 |
queue[ipos]->fp = &(arg->fp); |
| 3083 |
const int itmp = j * j + 2 * i + 1; |
| 3084 |
indcol[itmp] = ipos; |
| 3085 |
ipos++; |
| 3086 |
} // (!_isSym) |
| 3087 |
} // loop : i |
| 3088 |
|
| 3089 |
// diagonal |
| 3090 |
{ |
| 3091 |
string task_name = ("m " + to_string(j) + " " + to_string(j) |
| 3092 |
+ " : " + to_string(_level) + " : " |
| 3093 |
+ to_string(_nb)); |
| 3094 |
const long nrow = (long)_localSchur->nrowBlock(j, j); |
| 3095 |
const long ops = nrow * nrow; // dummy |
| 3096 |
C_deallocLocalSchur_arg<T> *arg = |
| 3097 |
new C_deallocLocalSchur_arg<T>(_isSym, |
| 3098 |
_localSchur, |
| 3099 |
j, |
| 3100 |
j, |
| 3101 |
verbose, |
| 3102 |
fp, |
| 3103 |
_nb); |
| 3104 |
*(arg->ops_complexity) = ops; |
| 3105 |
queue[ipos] = new C_task(C_DEALLOCLOCALSCHUR, |
| 3106 |
task_name, |
| 3107 |
(void *)arg, |
| 3108 |
C_deallocLocalSchur<T>, |
| 3109 |
1, // atomic_size |
| 3110 |
0, // atomic_id |
| 3111 |
arg->ops_complexity); |
| 3112 |
queue[ipos]->fp = &(arg->fp); |
| 3113 |
const int itmp = _isSym ? ((j * (j + 1)) / 2 + j) : (j * j + 2 * j); |
| 3114 |
indcol[itmp] = ipos; |
| 3115 |
ipos++; |
| 3116 |
} |
| 3117 |
} // loop : j |
| 3118 |
} |
| 3119 |
|
| 3120 |
template |
| 3121 |
void DissectionMatrix<double>:: |
| 3122 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3123 |
vector<int> &indcol, |
| 3124 |
const bool verbose, |
| 3125 |
FILE **fp); |
| 3126 |
|
| 3127 |
template |
| 3128 |
void DissectionMatrix<complex<double>, double>:: |
| 3129 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3130 |
vector<int> &indcol, |
| 3131 |
const bool verbose, |
| 3132 |
FILE **fp); |
| 3133 |
|
| 3134 |
template |
| 3135 |
void DissectionMatrix<quadruple>:: |
| 3136 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3137 |
vector<int> &indcol, |
| 3138 |
const bool verbose, |
| 3139 |
FILE **fp); |
| 3140 |
|
| 3141 |
template |
| 3142 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 3143 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3144 |
vector<int> &indcol, |
| 3145 |
const bool verbose, |
| 3146 |
FILE **fp); |
| 3147 |
|
| 3148 |
template |
| 3149 |
void DissectionMatrix<float>:: |
| 3150 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3151 |
vector<int> &indcol, |
| 3152 |
const bool verbose, |
| 3153 |
FILE **fp); |
| 3154 |
|
| 3155 |
template |
| 3156 |
void DissectionMatrix<complex<float>, float>:: |
| 3157 |
C_deallocLocalSchur_queue(vector<C_task*> &queue, |
| 3158 |
vector<int> &indcol, |
| 3159 |
const bool verbose, |
| 3160 |
FILE **fp); |
| 3161 |
// |
| 3162 |
|
| 3163 |
template<typename T, typename U> |
| 3164 |
void DissectionMatrix<T, U>:: |
| 3165 |
ChildContrib(list<child_contribution<T> > *child_contribs, |
| 3166 |
Dissection::Tree *btree, |
| 3167 |
vector<DissectionMatrix<T, U>* >& dM, |
| 3168 |
const bool verbose, |
| 3169 |
FILE **fp) |
| 3170 |
{ |
| 3171 |
int offset_diag_src = 0; |
| 3172 |
for (int ll = (_level - 1); ll >= 0; ll--) { |
| 3173 |
// copy of strips with shifting position from inside of each block to |
| 3174 |
// continous block |
| 3175 |
list<index_strip> diag; |
| 3176 |
list<index_strip> offdiag; |
| 3177 |
const int father_id = btree->nthfatherIndex(_nb, (_level - 1 - ll) + 1); |
| 3178 |
const Dissection::SetOfStrips &diag_xj = btree->getFathersStrips(_nb)[ll]; |
| 3179 |
int father_id0 = btree->selfIndex(father_id); |
| 3180 |
DissectionMatrix &fatherM = *dM[father_id0]; |
| 3181 |
|
| 3182 |
for (Dissection::SetOfStrips::const_iterator it = diag_xj.begin(); |
| 3183 |
it != diag_xj.end(); ++it) { |
| 3184 |
// destination is in dense matrix, then without offest |
| 3185 |
// offset = (*it).begin_dst - (*itf).begin_src = (*it).begin_dst; |
| 3186 |
// offset_offdiagf_src = 0; |
| 3187 |
// (*itf).begin_src + offset_offdiagf_src + offset |
| 3188 |
// == (*it).begin_dst |
| 3189 |
diag.push_back(index_strip((*it).begin_dst, |
| 3190 |
(*it).begin_src + offset_diag_src, |
| 3191 |
(*it).width)); |
| 3192 |
} |
| 3193 |
offset_diag_src += diag_xj.numberOfIndices(); |
| 3194 |
int offset_offdiagc_src = offset_diag_src; |
| 3195 |
for (int m = (ll - 1); m >= 0; m--) { |
| 3196 |
const Dissection::SetOfStrips &offdiag_xjc = |
| 3197 |
btree->getFathersStrips(_nb)[m]; |
| 3198 |
const Dissection::SetOfStrips &offdiag_xjf = |
| 3199 |
btree->getFathersStrips(father_id)[m]; |
| 3200 |
// |
| 3201 |
int offset_offdiagf_src = 0; |
| 3202 |
for (int k = ll - 1; k > m; k--) { |
| 3203 |
offset_offdiagf_src += |
| 3204 |
btree->getFathersStrips(father_id)[k].numberOfIndices(); |
| 3205 |
} |
| 3206 |
// strip is in increasing order with both begin_src (within condensed |
| 3207 |
// adderss of strips) and begin_dst (with column address in the block) |
| 3208 |
// Dissection::SetOfStrips::const_iterator itf = offdiag_xjf.begin(); |
| 3209 |
Dissection::SetOfStrips::const_iterator itf; |
| 3210 |
for (Dissection::SetOfStrips::const_iterator itc = offdiag_xjc.begin(); |
| 3211 |
itc != offdiag_xjc.end(); ++itc) { |
| 3212 |
// find a strip in offdiag strips with father_id |
| 3213 |
// bool found = false; |
| 3214 |
int offset = 0; |
| 3215 |
for (itf = offdiag_xjf.begin(); itf != offdiag_xjf.end(); ++itf) { |
| 3216 |
// for (; itf != offdiag_xjf.end(); ++itf) { |
| 3217 |
if (((*itf).begin_dst <= (*itc).begin_dst) && |
| 3218 |
((*itf).begin_dst + (*itf).width) >= |
| 3219 |
((*itc).begin_dst + (*itc).width)) { |
| 3220 |
offset = (*itc).begin_dst - (*itf).begin_dst; |
| 3221 |
// found = true; |
| 3222 |
break; |
| 3223 |
} |
| 3224 |
} |
| 3225 |
offdiag.push_back(index_strip(((*itf).begin_src + |
| 3226 |
offset_offdiagf_src + |
| 3227 |
offset), |
| 3228 |
(*itc).begin_src + |
| 3229 |
offset_offdiagc_src, |
| 3230 |
(*itc).width)); |
| 3231 |
} |
| 3232 |
offset_offdiagc_src += offdiag_xjc.numberOfIndices(); |
| 3233 |
} //loop : ll |
| 3234 |
|
| 3235 |
// cout << "** father_id = " << father_id << endl; |
| 3236 |
|
| 3237 |
list<child_contribution<T> > &tmp = child_contribs[father_id0]; |
| 3238 |
if (fatherM.nrow() == 0 || _nrow == 0) { |
| 3239 |
diss_printf(verbose, *fp, "%s %d : %d/%d %d/%d %d %d:%d\n", |
| 3240 |
__FILE__, __LINE__, |
| 3241 |
_nrow, _nb, fatherM.nrow(), father_id, ll, |
| 3242 |
(int)diag.size(), (int)offdiag.size()); |
| 3243 |
diag.clear(); |
| 3244 |
if (_nrow == 0) { |
| 3245 |
offdiag.clear(); |
| 3246 |
} |
| 3247 |
} |
| 3248 |
int child_id = btree->selfIndex(_nb); |
| 3249 |
tmp.push_back(child_contribution<T>(child_id, |
| 3250 |
fatherM.nrow(), |
| 3251 |
fatherM.getUpperNCol(), |
| 3252 |
diag, |
| 3253 |
offdiag, |
| 3254 |
fatherM.addrdiagBlock(), |
| 3255 |
fatherM.addrupperBlock(), |
| 3256 |
(!_isSym) ? fatherM.addrlowerBlock() : (RectBlockMatrix<T> *)NULL, |
| 3257 |
_ncol_offdiag, |
| 3258 |
_localSchur)); |
| 3259 |
} // loop : ll |
| 3260 |
} |
| 3261 |
|
| 3262 |
template |
| 3263 |
void DissectionMatrix<double>:: |
| 3264 |
ChildContrib(list<child_contribution<double> > *child_contribs, |
| 3265 |
Dissection::Tree *btree, |
| 3266 |
vector<DissectionMatrix<double>* >& dM, |
| 3267 |
const bool verbose, |
| 3268 |
FILE **fp); |
| 3269 |
|
| 3270 |
template |
| 3271 |
void DissectionMatrix<complex<double>, double>:: |
| 3272 |
ChildContrib(list<child_contribution<complex<double> > > *child_contribs, |
| 3273 |
Dissection::Tree *btree, |
| 3274 |
vector<DissectionMatrix<complex<double>, double>* >& dM, |
| 3275 |
const bool verbose, |
| 3276 |
FILE **fp); |
| 3277 |
|
| 3278 |
template |
| 3279 |
void DissectionMatrix<quadruple>:: |
| 3280 |
ChildContrib(list<child_contribution<quadruple> > *child_contribs, |
| 3281 |
Dissection::Tree *btree, |
| 3282 |
vector<DissectionMatrix<quadruple>* >& dM, |
| 3283 |
const bool verbose, |
| 3284 |
FILE **fp); |
| 3285 |
|
| 3286 |
template |
| 3287 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 3288 |
ChildContrib(list<child_contribution<complex<quadruple> > > *child_contribs, |
| 3289 |
Dissection::Tree *btree, |
| 3290 |
vector<DissectionMatrix<complex<quadruple>, quadruple>* >& dM, |
| 3291 |
const bool verbose, |
| 3292 |
FILE **fp); |
| 3293 |
|
| 3294 |
template |
| 3295 |
void DissectionMatrix<float>:: |
| 3296 |
ChildContrib(list<child_contribution<float> > *child_contribs, |
| 3297 |
Dissection::Tree *btree, |
| 3298 |
vector<DissectionMatrix<float>* >& dM, |
| 3299 |
const bool verbose, |
| 3300 |
FILE **fp); |
| 3301 |
|
| 3302 |
template |
| 3303 |
void DissectionMatrix<complex<float>, float>:: |
| 3304 |
ChildContrib(list<child_contribution<complex<float> > > *child_contribs, |
| 3305 |
Dissection::Tree *btree, |
| 3306 |
vector<DissectionMatrix<complex<float>, float>* >& dM, |
| 3307 |
const bool verbose, |
| 3308 |
FILE **fp); |
| 3309 |
// |
| 3310 |
|
| 3311 |
template<typename T, typename U> |
| 3312 |
void DissectionMatrix<T, U>::deallocLower_queue(C_task*& queue, |
| 3313 |
bool isSym, |
| 3314 |
vector<C_task*> &task_p, |
| 3315 |
bool isDirect, |
| 3316 |
vector<C_task*> &task_q) |
| 3317 |
{ |
| 3318 |
string task_name = "M : " + to_string(_nb); |
| 3319 |
|
| 3320 |
// char *task_name_cstr = new char[task_name.str().size() + 1]; |
| 3321 |
// strcpy(task_name_cstr, task_name.str().c_str()); |
| 3322 |
|
| 3323 |
const int ops_complexity = _ncol_offdiag * _nrow; |
| 3324 |
C_deallocLower_arg<T> *arg = new C_deallocLower_arg<T>(isSym, |
| 3325 |
_lower, |
| 3326 |
ops_complexity); |
| 3327 |
|
| 3328 |
queue = new C_task(C_DEALLOCLOWER, |
| 3329 |
task_name, |
| 3330 |
(void *)arg, |
| 3331 |
C_deallocLower<T>, |
| 3332 |
1, // atomic_size |
| 3333 |
0, // atomic_id |
| 3334 |
arg->ops_complexity); |
| 3335 |
for (vector<C_task *>::const_iterator it = task_p.begin(); |
| 3336 |
it != task_p.end(); ++it) { |
| 3337 |
queue->parents->push_back(*it); |
| 3338 |
} |
| 3339 |
if (isDirect) { |
| 3340 |
for (int i = 0; i < task_q[0]->parallel_max; i++) { |
| 3341 |
queue->parents->push_back(task_q[i]); |
| 3342 |
} |
| 3343 |
queue->parents->sort(compare_task_name); |
| 3344 |
queue->parents->unique(); |
| 3345 |
} |
| 3346 |
} |
| 3347 |
|
| 3348 |
template |
| 3349 |
void DissectionMatrix<double>:: |
| 3350 |
deallocLower_queue(C_task*& queue, |
| 3351 |
bool isSym, |
| 3352 |
vector<C_task*> &task_p, |
| 3353 |
bool isDirect, |
| 3354 |
vector<C_task*> &task_q); |
| 3355 |
|
| 3356 |
template |
| 3357 |
void DissectionMatrix<complex<double>, double>:: |
| 3358 |
deallocLower_queue(C_task*& queue, |
| 3359 |
bool isSym, |
| 3360 |
vector<C_task*> &task_p, |
| 3361 |
bool isDirect, |
| 3362 |
vector<C_task*> &task_q); |
| 3363 |
|
| 3364 |
template |
| 3365 |
void DissectionMatrix<quadruple>:: |
| 3366 |
deallocLower_queue(C_task*& queue, |
| 3367 |
bool isSym, |
| 3368 |
vector<C_task*> &task_p, |
| 3369 |
bool isDirect, |
| 3370 |
vector<C_task*> &task_q); |
| 3371 |
|
| 3372 |
template |
| 3373 |
void DissectionMatrix<complex<quadruple>, quadruple>:: |
| 3374 |
deallocLower_queue(C_task*& queue, |
| 3375 |
bool isSym, |
| 3376 |
vector<C_task*> &task_p, |
| 3377 |
bool isDirect, |
| 3378 |
vector<C_task*> &task_q); |
| 3379 |
|
| 3380 |
template |
| 3381 |
void DissectionMatrix<float>:: |
| 3382 |
deallocLower_queue(C_task*& queue, |
| 3383 |
bool isSym, |
| 3384 |
vector<C_task*> &task_p, |
| 3385 |
bool isDirect, |
| 3386 |
vector<C_task*> &task_q); |
| 3387 |
|
| 3388 |
template |
| 3389 |
void DissectionMatrix<complex<float>, float>:: |
| 3390 |
deallocLower_queue(C_task*& queue, |
| 3391 |
bool isSym, |
| 3392 |
vector<C_task*> &task_p, |
| 3393 |
bool isDirect, |
| 3394 |
vector<C_task*> &task_q); |
| 3395 |
// |