Commit 52c188d9 authored by Mathieu Faverge's avatar Mathieu Faverge

Factorize migrate calls, and fix tpm* kernels

parent 2b10aac1
......@@ -26,8 +26,7 @@
#define T(m,n) T, (m), (n)
#define D(m,n) D, (m), (n)
/*
/**
* Parallel tile LQ factorization (reduction Householder) - dynamic scheduling
*/
void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t *A,
......@@ -41,11 +40,10 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
size_t ws_host = 0;
int k, m, n, i, p;
int K, L;
int K, L, nbgeqrt;
int ldak, ldam, lddk;
int tempkmin, tempkm, tempnn, tempmm, temppn;
int ib;
int *tiles;
int ib, node, nbtiles, *tiles;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -60,37 +58,32 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
}
/*
* zgelqt = A->nb * (ib+1)
* zunmlq = A->nb * ib
* ztslqt = A->nb * (ib+1)
* zttlqt = A->nb * (ib+1)
* ztsmlq = A->nb * ib
* zttmlq = A->nb * ib
* zgelqt = A->nb * (ib+1)
* zunmlq = A->nb * ib
* ztplqt = A->nb * (ib+1)
* ztpmlqt = A->nb * ib
*/
ws_worker = A->nb * (ib+1);
/* Allocation of temporary (scratch) working space */
#if defined(CHAMELEON_USE_CUDA)
/* Worker space
*
* zunmlq = A->nb * ib
* ztsmlq = 2 * A->nb * ib
/*
* zunmqr = A->nb * ib
* ztpmqrt = 2 * A->nb * ib
*/
ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
#endif
/* Initialisation of tiles */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
ws_worker *= sizeof(CHAMELEON_Complex64_t);
ws_host *= sizeof(CHAMELEON_Complex64_t);
RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
/* Initialisation of temporary tiles array */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
K = chameleon_min(A->mt, A->nt);
/* The number of the factorization */
for (k = 0; k < K; k++) {
RUNTIME_iteration_push(chamctxt, k);
......@@ -98,9 +91,11 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
ldak = BLKLDD(A, k);
lddk = BLKLDD(D, k);
T = TS;
/* The number of geqrt to apply */
for (i = 0; i < qrtree->getnbgeqrf(qrtree, k); i++) {
nbgeqrt = qrtree->getnbgeqrf(qrtree, k);
T = TS;
for (i = 0; i < nbgeqrt; i++) {
p = qrtree->getm(qrtree, k, i);
temppn = p == A->nt-1 ? A->n-p*A->nb : A->nb;
tempkmin = chameleon_min(tempkm, temppn);
......@@ -110,6 +105,7 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
tempkm, temppn, ib, T->nb,
A( k, p), ldak,
T(k, p), T->mb);
if ( genD ) {
INSERT_TASK_zlacpy(
&options,
......@@ -124,13 +120,14 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
D(k, p), lddk );
#endif
}
for (m = k+1; m < A->mt; m++) {
tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
ldam = BLKLDD(A, m);
INSERT_TASK_zunmlq(
&options,
ChamRight, ChamConjTrans,
tempmm, temppn, tempkmin, ib, T->nb,
tempmm, temppn, tempkmin, ib, T->nb,
D(k, p), lddk,
T(k, p), T->mb,
A(m, p), ldam);
......@@ -140,15 +137,15 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
}
/* Setting the order of the tiles */
libhqr_walk_stepk( qrtree, k, tiles + (k+1) );
nbtiles = libhqr_walk_stepk( qrtree, k, tiles );
for (i = k+1; i < A->nt; i++) {
for (i = 0; i < nbtiles; i++) {
n = tiles[i];
p = qrtree->currpiv(qrtree, k, n);
tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
if (qrtree->gettype(qrtree, k, n) == 0) {
if ( qrtree->gettype(qrtree, k, n) == LIBHQR_KILLED_BY_TS ) {
/* TS kernel */
T = TS;
L = 0;
......@@ -159,10 +156,9 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
L = tempnn;
}
RUNTIME_data_migrate( sequence, A(k, p),
A->get_rankof( A, k, n ) );
RUNTIME_data_migrate( sequence, A(k, n),
A->get_rankof( A, k, n ) );
node = A->get_rankof( A, k, n );
RUNTIME_data_migrate( sequence, A(k, p), node );
RUNTIME_data_migrate( sequence, A(k, n), node );
INSERT_TASK_ztplqt(
&options,
......@@ -175,10 +171,9 @@ void chameleon_pzgelqf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
ldam = BLKLDD(A, m);
RUNTIME_data_migrate( sequence, A(m, p),
A->get_rankof( A, m, n ) );
RUNTIME_data_migrate( sequence, A(m, n),
A->get_rankof( A, m, n ) );
node = A->get_rankof( A, m, n );
RUNTIME_data_migrate( sequence, A(m, p), node );
RUNTIME_data_migrate( sequence, A(m, n), node );
INSERT_TASK_ztpmlqt(
&options,
......
......@@ -46,7 +46,7 @@ void chameleon_pzgelqfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
int K, N, RD;
int ldak, ldam, lddk;
int tempkmin, tempkm, tempNn, tempnn, tempmm, tempNRDn;
int ib;
int ib, node;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -167,10 +167,9 @@ void chameleon_pzgelqfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
for (N = k; N+RD < A->nt; N += 2*RD) {
tempNRDn = N+RD == A->nt-1 ? A->n-(N+RD)*A->nb : A->nb;
RUNTIME_data_migrate( sequence, A(k, N),
A->get_rankof( A, k, N+RD ) );
RUNTIME_data_migrate( sequence, A(k, N+RD),
A->get_rankof( A, k, N+RD ) );
node = A->get_rankof( A, k, N+RD );
RUNTIME_data_migrate( sequence, A(k, N), node );
RUNTIME_data_migrate( sequence, A(k, N+RD), node );
/* TT kernel */
INSERT_TASK_ztplqt(
......@@ -184,10 +183,9 @@ void chameleon_pzgelqfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
ldam = BLKLDD(A, m );
RUNTIME_data_migrate( sequence, A(m, N),
A->get_rankof( A, m, N+RD ) );
RUNTIME_data_migrate( sequence, A(m, N+RD),
A->get_rankof( A, m, N+RD ) );
node = A->get_rankof( A, m, N+RD );
RUNTIME_data_migrate( sequence, A(m, N), node );
RUNTIME_data_migrate( sequence, A(m, N+RD), node );
INSERT_TASK_ztpmlqt(
&options,
......
......@@ -22,16 +22,21 @@
#include <stdlib.h>
#include "libhqr.h"
#define A(m,n) A, (m), (n)
#define T(m,n) T, (m), (n)
#define D(m,n) D, (m), (n)
#define A(m,n) A, (m), (n)
#define T(m,n) T, (m), (n)
#define D(m,n) D, (m), (n)
/**
* Parallel tile QR factorization (reduction Householder) - dynamic scheduling
*
* @param[in] genD
* Indicate if the copies of the geqrt tiles must be done to speedup
* computations in updates.
*/
void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t *A,
void chameleon_pzgeqrf_param( int genD, int K,
const libhqr_tree_t *qrtree, CHAM_desc_t *A,
CHAM_desc_t *TS, CHAM_desc_t *TT, CHAM_desc_t *D,
RUNTIME_sequence_t *sequence, RUNTIME_request_t *request)
RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
{
CHAM_context_t *chamctxt;
RUNTIME_option_t options;
......@@ -40,11 +45,10 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
size_t ws_host = 0;
int k, m, n, i, p;
int K, L, nbgeqrt;
int L, nbgeqrt;
int ldap, ldam, lddm;
int tempkmin, tempkn, tempnn, tempmm;
int ib;
int *tiles;
int ib, node, nbtiles, *tiles;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -75,23 +79,22 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
#endif
/* Initialisation of temporary tiles array */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
ws_worker *= sizeof(CHAMELEON_Complex64_t);
ws_host *= sizeof(CHAMELEON_Complex64_t);
RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
K = chameleon_min(A->mt, A->nt);
/* Initialisation of temporary tiles array */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
/* The number of the factorization */
for (k = 0; k < K; k++) {
RUNTIME_iteration_push(chamctxt, k);
tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
/* The number of geqrt to apply */
nbgeqrt = qrtree->getnbgeqrf(qrtree, k);
T = TS;
for (i = 0; i < nbgeqrt; i++) {
m = qrtree->getm(qrtree, k, i);
tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
......@@ -99,13 +102,12 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
ldam = BLKLDD(A, m);
lddm = BLKLDD(D, m);
T = TS;
INSERT_TASK_zgeqrt(
&options,
tempmm, tempkn, ib, T->nb,
A(m, k), ldam,
T(m, k), T->mb);
if ( genD ) {
INSERT_TASK_zlacpy(
&options,
......@@ -120,6 +122,7 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
D(m, k), lddm );
#endif
}
for (n = k+1; n < A->nt; n++) {
tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
INSERT_TASK_zunmqr(
......@@ -135,9 +138,9 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
}
/* Setting the order of the tiles */
libhqr_walk_stepk( qrtree, k, tiles + (k+1) );
nbtiles = libhqr_walk_stepk( qrtree, k, tiles );
for (i = k+1; i < A->mt; i++) {
for (i = 0; i < nbtiles; i++) {
m = tiles[i];
p = qrtree->currpiv(qrtree, k, m);
......@@ -145,7 +148,7 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
ldap = BLKLDD(A, p);
ldam = BLKLDD(A, m);
if (qrtree->gettype(qrtree, k, m) == 0) {
if ( qrtree->gettype(qrtree, k, m) == LIBHQR_KILLED_BY_TS ) {
/* TS kernel */
T = TS;
L = 0;
......@@ -156,10 +159,9 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
L = tempmm;
}
RUNTIME_data_migrate( sequence, A(p, k),
A->get_rankof( A, m, k ) );
RUNTIME_data_migrate( sequence, A(m, k),
A->get_rankof( A, m, k ) );
node = A->get_rankof( A, m, k );
RUNTIME_data_migrate( sequence, A(p, k), node );
RUNTIME_data_migrate( sequence, A(m, k), node );
INSERT_TASK_ztpqrt(
&options,
......@@ -171,10 +173,9 @@ void chameleon_pzgeqrf_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
for (n = k+1; n < A->nt; n++) {
tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
RUNTIME_data_migrate( sequence, A(p, n),
A->get_rankof( A, m, n ) );
RUNTIME_data_migrate( sequence, A(m, n),
A->get_rankof( A, m, n ) );
node = A->get_rankof( A, m, n );
RUNTIME_data_migrate( sequence, A(p, n), node );
RUNTIME_data_migrate( sequence, A(m, n), node );
INSERT_TASK_ztpmqrt(
&options,
......
......@@ -46,7 +46,7 @@ void chameleon_pzgeqrfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
int K, M, RD;
int ldaM, ldam, ldaMRD, lddM;
int tempkmin, tempkn, tempMm, tempnn, tempmm, tempMRDm;
int ib;
int ib, node;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -166,10 +166,9 @@ void chameleon_pzgeqrfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
ldaM = BLKLDD(A, M );
ldaMRD = BLKLDD(A, M+RD);
RUNTIME_data_migrate( sequence, A(M, k),
A->get_rankof( A, M+RD, k ) );
RUNTIME_data_migrate( sequence, A(M+RD, k),
A->get_rankof( A, M+RD, k ) );
node = A->get_rankof( A, M+RD, k );
RUNTIME_data_migrate( sequence, A(M, k), node );
RUNTIME_data_migrate( sequence, A(M+RD, k), node );
/* TT kernel */
INSERT_TASK_ztpqrt(
......@@ -182,10 +181,9 @@ void chameleon_pzgeqrfrh( int genD, int BS, CHAM_desc_t *A, CHAM_desc_t *T, CHAM
for (n = k+1; n < A->nt; n++) {
tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
RUNTIME_data_migrate( sequence, A(M, n),
A->get_rankof( A, M+RD, n ) );
RUNTIME_data_migrate( sequence, A(M+RD, n),
A->get_rankof( A, M+RD, n ) );
node = A->get_rankof( A, M+RD, n );
RUNTIME_data_migrate( sequence, A(M, n), node );
RUNTIME_data_migrate( sequence, A(M+RD, n), node );
INSERT_TASK_ztpmqrt(
&options,
......
......@@ -20,8 +20,6 @@
*/
#include "control/common.h"
#define V1(m,n) V1, m, n
#define T1(m,n) T1, m, n
#define V2(m,n) V2, m, n
#define T2(m,n) T2, m, n
#define Q1(m,n) Q1, m, n
......@@ -31,11 +29,9 @@
/**
* Parallel tile QR factorization - dynamic scheduling
*/
void chameleon_pztpgqrt( int genD, int L,
CHAM_desc_t *V1, CHAM_desc_t *T1,
void chameleon_pztpgqrt( int KT, int L,
CHAM_desc_t *V2, CHAM_desc_t *T2,
CHAM_desc_t *Q1, CHAM_desc_t *Q2,
CHAM_desc_t *D,
RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
{
CHAM_context_t *chamctxt;
......@@ -46,7 +42,7 @@ void chameleon_pztpgqrt( int genD, int L,
int k, m, n;
int ldvk, ldvm, lddk;
int ldqk, ldqm;
int tempkm, tempkn, tempkk, tempnn, tempmm, templm;
int tempkn, tempnn, tempmm, templm;
int ib;
/* Dimension of the first column */
......@@ -61,11 +57,6 @@ void chameleon_pztpgqrt( int genD, int L,
ib = CHAMELEON_IB;
if ( D == NULL ) {
D = V1;
genD = 0;
}
/*
* ztpmqrt = Q1->nb * ib
*/
......@@ -85,21 +76,17 @@ void chameleon_pztpgqrt( int genD, int L,
RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
for (k = V1->nt-1; k >= 0; k--) {
for (k = KT-1; k >= 0; k--) {
RUNTIME_iteration_push(chamctxt, k);
tempkm = k == V1->mt-1 ? V1->m-k*V1->mb : V1->mb;
tempkk = k == V1->nt-1 ? V1->n-k*V1->nb : V1->nb;
tempkn = k == Q1->nt-1 ? Q1->n-k*Q1->nb : Q1->nb;
ldvk = BLKLDD(V1, k);
lddk = BLKLDD(D, k);
ldqk = BLKLDD(Q1, k);
/* Equivalent to the tsmqr step on Q1,Q2 */
maxmtk = chameleon_min( Q2->mt, maxmt+k ) - 1;
for (m = maxmtk; m > -1; m--) {
tempmm = m == Q2->mt-1 ? Q2->m-m*Q2->mb : Q2->mb;
templm = m == maxmtk ? tempmm : 0;
templm = ((L > 0) && (m == maxmtk)) ? tempmm : 0;
ldvm = BLKLDD(V2, m);
ldqm = BLKLDD(Q2, m);
......@@ -117,53 +104,9 @@ void chameleon_pztpgqrt( int genD, int L,
}
}
for (m = Q1->mt - 1; m > k; m--) {
tempmm = m == Q1->mt-1 ? Q1->m-m*Q1->mb : Q1->mb;
ldvm = BLKLDD(V1, m);
ldqm = BLKLDD(Q1, m);
for (n = k; n < Q1->nt; n++) {
tempnn = n == Q1->nt-1 ? Q1->n-n*Q1->nb : Q1->nb;
/* TS kernel */
INSERT_TASK_ztpmqrt(
&options,
ChamLeft, ChamNoTrans,
tempmm, tempnn, tempkn, 0, ib, T1->nb,
V1(m, k), ldvm,
T1(m, k), T1->mb,
Q1(k, n), ldqk,
Q1(m, n), ldqm );
}
}
if ( genD ) {
INSERT_TASK_zlacpy(
&options,
ChamLower, tempkm, tempkk, V1->nb,
V1(k, k), ldvk,
D(k), lddk );
#if defined(CHAMELEON_USE_CUDA)
INSERT_TASK_zlaset(
&options,
ChamUpper, tempkm, tempkk,
0., 1.,
D(k), lddk );
#endif
}
for (n = k; n < Q1->nt; n++) {
tempnn = n == Q1->nt-1 ? Q1->n-n*Q1->nb : Q1->nb;
INSERT_TASK_zunmqr(
&options,
ChamLeft, ChamNoTrans,
tempkm, tempnn, tempkk, ib, T1->nb,
D(k), lddk,
T1(k, k), T1->mb,
Q1(k, n), ldqk);
}
RUNTIME_iteration_pop(chamctxt);
}
RUNTIME_options_ws_free(&options);
RUNTIME_options_finalize(&options, chamctxt);
(void)D;
}
......@@ -20,9 +20,9 @@
*/
#include "control/common.h"
#define A(m,n) A, m, n
#define B(m,n) B, m, n
#define T(m,n) T, m, n
#define A(m,n) A, (m), (n)
#define B(m,n) B, (m), (n)
#define T(m,n) T, (m), (n)
/**
* Parallel tile QR factorization - dynamic scheduling
......@@ -53,15 +53,14 @@ void chameleon_pztpqrt( int L, CHAM_desc_t *A, CHAM_desc_t *B, CHAM_desc_t *T,
ib = CHAMELEON_IB;
/*
* ztsqrt = A->nb * (ib+1)
* ztpqrt = A->nb * (ib+1)
* ztpmqrt = A->nb * ib
*/
ws_worker = A->nb * (ib+1);
/* Allocation of temporary (scratch) working space */
#if defined(CHAMELEON_USE_CUDA)
/* Worker space
*
/*
* ztpmqrt = 2 * A->nb * ib
*/
ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
......@@ -81,7 +80,7 @@ void chameleon_pztpqrt( int L, CHAM_desc_t *A, CHAM_desc_t *B, CHAM_desc_t *T,
for (m = 0; m < maxmt; m++) {
tempmm = m == B->mt-1 ? B->m-m*B->mb : B->mb;
templm = m == maxmt-1 ? tempmm : 0;
templm = ((L > 0) && (m == maxmt-1)) ? tempmm : 0;
ldbm = BLKLDD(B, m);
/* TT kernel */
INSERT_TASK_ztpqrt(
......
......@@ -43,8 +43,7 @@ void chameleon_pzunglq_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
int K, L;
int ldak, ldqm, lddk;
int tempkm, tempkmin, temppn, tempnn, tempmm;
int ib;
int *tiles;
int ib, node, nbtiles, *tiles;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -77,15 +76,14 @@ void chameleon_pzunglq_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
#endif
/* Initialisation of tiles */
tiles = (int*)calloc( qrtree->mt, sizeof(int));
ws_worker *= sizeof(CHAMELEON_Complex64_t);
ws_host *= sizeof(CHAMELEON_Complex64_t);
RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
/* Initialisation of tiles */
tiles = (int*)calloc( qrtree->mt, sizeof(int));
K = chameleon_min(A->mt, A->nt);
for (k = K-1; k >= 0; k--) {
......@@ -96,15 +94,15 @@ void chameleon_pzunglq_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
lddk = BLKLDD(D, k);
/* Setting the order of the tiles*/
libhqr_walk_stepk(qrtree, k, tiles + (k+1));
nbtiles = libhqr_walk_stepk( qrtree, k, tiles );
for (i = A->nt-1; i > k; i--) {
for (i = nbtiles-1; i >= 0; i--) {
n = tiles[i];
p = qrtree->currpiv(qrtree, k, n);
tempnn = n == Q->nt-1 ? Q->n-n*Q->nb : Q->nb;
if(qrtree->gettype(qrtree, k, n) == 0){
if( qrtree->gettype(qrtree, k, n) == LIBHQR_KILLED_BY_TS ) {
/* TS kernel */
L = 0;
T = TS;
......@@ -118,10 +116,9 @@ void chameleon_pzunglq_param( int genD, const libhqr_tree_t *qrtree, CHAM_desc_t
tempmm = m == Q->mt-1 ? Q->m-m*Q->mb : Q->mb;
ldqm = BLKLDD(Q, m);
RUNTIME_data_migrate( sequence, Q(m, p),
Q->get_rankof( Q, m, n ) );
RUNTIME_data_migrate( sequence, Q(m, n),
Q->get_rankof( Q, m, n ) );
node = Q->get_rankof( Q, m, n );
RUNTIME_data_migrate( sequence, Q(m, p), node );
RUNTIME_data_migrate( sequence, Q(m, n), node );
INSERT_TASK_ztpmlqt(
&options,
......
......@@ -48,7 +48,7 @@ void chameleon_pzunglqrh( int genD, int BS,
int K, N, RD, lastRD;
int ldak, lddk, ldqm;
int tempkm, tempkmin, tempNn, tempnn, tempmm, tempNRDn;
int ib;
int ib, node;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -99,10 +99,9 @@ void chameleon_pzunglqrh( int genD, int BS,
tempmm = m == Q->mt-1 ? Q->m-m*Q->mb : Q->mb;
ldqm = BLKLDD(Q, m );
RUNTIME_data_migrate( sequence, Q(m, N),
Q->get_rankof( Q, m, N+RD ) );
RUNTIME_data_migrate( sequence, Q(m, N+RD),
Q->get_rankof( Q, m, N+RD ) );
node = Q->get_rankof( Q, m, N+RD );
RUNTIME_data_migrate( sequence, Q(m, N), node );
RUNTIME_data_migrate( sequence, Q(m, N+RD), node );
/* TT kernel */
INSERT_TASK_ztpmlqt(
......@@ -129,10 +128,9 @@ void chameleon_pzunglqrh( int genD, int BS,
tempmm = m == Q->mt-1 ? Q->m-m*Q->mb : Q->mb;
ldqm = BLKLDD(Q, m);
RUNTIME_data_migrate( sequence, Q(m, N),
Q->get_rankof( Q, m, n ) );
RUNTIME_data_migrate( sequence, Q(m, n),
Q->get_rankof( Q, m, n ) );
node = Q->get_rankof( Q, m, n );
RUNTIME_data_migrate( sequence, Q(m, N), node );
RUNTIME_data_migrate( sequence, Q(m, n), node );
/* TS kernel */
INSERT_TASK_ztpmlqt(
......
......@@ -29,7 +29,8 @@
/**
* Parallel construction of Q using tile V (application to identity) - dynamic scheduling
*/
void chameleon_pzungqr_param( int genD, const libhqr_tree_t *qrtree,
void chameleon_pzungqr_param( int genD, int K,
const libhqr_tree_t *qrtree,
CHAM_desc_t *A, CHAM_desc_t *Q,
CHAM_desc_t *TS, CHAM_desc_t *TT, CHAM_desc_t *D,
RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
......@@ -43,8 +44,7 @@ void chameleon_pzungqr_param( int genD, const libhqr_tree_t *qrtree,
int k, m, n, i, p, L;
int ldam, ldqm, ldqp, lddm;
int tempmm, tempnn, tempkmin, tempkn;
int ib, minMT;
int *tiles;
int ib, nbgeqrt, node, nbtiles, *tiles;
chamctxt = chameleon_context_self();
if (sequence->status != CHAMELEON_SUCCESS)
......@@ -53,12 +53,6 @@ void chameleon_pzungqr_param( int genD, const libhqr_tree_t *qrtree,
ib = CHAMELEON_IB;
if (A->m > A->n) {
minMT = A->nt;
} else {
minMT = A->mt;
}
if (D == NULL) {
D = A;
genD = 0;
......@@ -66,47 +60,44 @@ void chameleon_pzungqr_param( int genD, const libhqr_tree_t *qrtree,
/*
* zunmqr = A->nb * ib
* ztsmqr = A->nb * ib
* ztpmqr = A->nb * ib
*/
ws_worker = A->nb * ib;
/* Allocation of temporary (scratch) working space */
#if defined(CHAMELEON_USE_CUDA)
/* Worker space
*
* zunmqr = A->nb * ib
* ztsmqr = 2 * A->nb * ib
/*
* ztpmqrt = 2 * A->nb * ib
*/
ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
#endif
/* Initialisation of tiles */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
ws_worker *= sizeof(CHAMELEON_Complex64_t);
ws_host *= sizeof(CHAMELEON_Complex64_t);
RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
for (k = minMT-1; k >= 0; k--) {
/* Initialisation of temporary tiles array */
tiles = (int*)calloc(qrtree->mt, sizeof(int));
for (k = K-1; k >=0; k--) {
RUNTIME_iteration_push(chamctxt, k);
tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
/* Setting the order of tiles */
libhqr_walk_stepk(qrtree, k, tiles + (k+1));
nbtiles = libhqr_walk_stepk( qrtree, k, tiles );
for (i = Q->mt-1; i > k; i--) {
for (i = nbtiles-1; i >= 0; i--) {
m = tiles[i];
p = qrtree->currpiv(qrtree, k, m);
tempmm = m == Q->mt-1 ? Q->m-m*Q->mb : Q->mb;
ldqp = BLKLDD(Q, p);
ldam = BLKLDD(A, m);
ldqm = BLKLDD(Q, m);
ldqp = BLKLDD(Q, p);
if(qrtree->gettype(qrtree, k , m) == 0) {
if( qrtree->gettype(qrtree, k, m) == LIBHQR_KILLED_BY_TS ) {
/* TS kernel */
T = TS;
L = 0;
......@@ -120,10 +111,9 @@ void chameleon_pzungqr_param( int genD, const libhqr_tree_t *qrtree,
for (n = k; n < Q->nt; n++) {
tempnn = n == Q->nt-1 ? Q->n-n*Q->nb : Q->nb;