/***************************************************************************//** * Parallel tile LU factorization - static scheduling **/ void plasma_pzgetrf_incpiv(plasma_context_t *plasma) { PLASMA_desc A; PLASMA_desc L; int *IPIV; PLASMA_sequence *sequence; PLASMA_request *request; int k, m, n; int next_k; int next_m; int next_n; int ldak, ldam; int info; int tempkn, tempkm, tempmm, tempnn; int ib = PLASMA_IB; PLASMA_Complex64_t *work; plasma_unpack_args_5(A, L, IPIV, sequence, request); if (sequence->status != PLASMA_SUCCESS) return; work = (PLASMA_Complex64_t*)plasma_private_alloc(plasma, ib*L.nb, L.dtyp); ss_init(A.mt, A.nt, -1); k = 0; n = PLASMA_RANK; while (n >= A.nt) { k++; n = n-A.nt+k; } m = k; while (k < min(A.mt, A.nt) && n < A.nt && !ss_aborted()) { next_n = n; next_m = m; next_k = k; next_m++; if (next_m == A.mt) { next_n += PLASMA_SIZE; while (next_n >= A.nt && next_k < min(A.mt, A.nt)) { next_k++; next_n = next_n-A.nt+next_k; } next_m = next_k; } tempmm = m == A.mt-1 ? A.m-m*A.mb : A.mb; tempkm = k == A.mt-1 ? A.m-k*A.mb : A.mb; tempkn = k == A.nt-1 ? A.n-k*A.nb : A.nb; tempnn = n == A.nt-1 ? A.n-n*A.nb : A.nb; ldak = BLKLDD(A, k); ldam = BLKLDD(A, m); if (n == k) { if (m == k) { ss_cond_wait(k, k, k-1); CORE_zgetrf_incpiv( tempkm, tempkn, ib, A(k, k), ldak, IPIV(k, k), &info); if (info != 0 && m == A.mt-1) { plasma_request_fail(sequence, request, info + A.nb*k); ss_abort(); } ss_cond_set(k, k, k); } else { ss_cond_wait(m, k, k-1); CORE_ztstrf( tempmm, tempkn, ib, A.nb, A(k, k), ldak, A(m, k), ldam, L(m, k), L.mb, IPIV(m, k), work, L.nb, &info); if (info != 0 && m == A.mt-1) { plasma_request_fail(sequence, request, info + A.nb*k); ss_abort(); } ss_cond_set(m, k, k); } } else { if (m == k) { ss_cond_wait(k, k, k); ss_cond_wait(k, n, k-1); CORE_zgessm( tempkm, tempnn, tempkm, ib, IPIV(k, k), A(k, k), ldak, A(k, n), ldak); } else { ss_cond_wait(m, k, k); ss_cond_wait(m, n, k-1); CORE_zssssm( A.nb, tempnn, tempmm, tempnn, A.nb, ib, A(k, n), ldak, A(m, n), ldam, L(m, k), L.mb, A(m, k), ldam, IPIV(m, k)); ss_cond_set(m, n, k); } } n = next_n; m = next_m; k = next_k; } plasma_private_free(plasma, work); ss_finalize(); }
/* Fatal error */ void ss_error(char *str, int error) { fprintf(stderr, "*** [Thread %i] %s\n", ss_get_thread_num(), str); ss_abort(error); }
void impl_abort(int err) { ss_abort(err); }
/***************************************************************************//** * Parallel tile Cholesky factorization - static scheduling **/ void plasma_pspotrf(plasma_context_t *plasma) { PLASMA_enum uplo; PLASMA_desc A; PLASMA_sequence *sequence; PLASMA_request *request; int k, m, n; int next_k; int next_m; int next_n; int ldak, ldam, ldan; int info; int tempkn, tempmn; float zone = (float) 1.0; float mzone = (float)-1.0; plasma_unpack_args_4(uplo, A, sequence, request); if (sequence->status != PLASMA_SUCCESS) return; ss_init(A.nt, A.nt, 0); k = 0; m = PLASMA_RANK; while (m >= A.nt) { k++; m = m-A.nt+k; } n = 0; while (k < A.nt && m < A.nt && !ss_aborted()) { next_n = n; next_m = m; next_k = k; next_n++; if (next_n > next_k) { next_m += PLASMA_SIZE; while (next_m >= A.nt && next_k < A.nt) { next_k++; next_m = next_m-A.nt+next_k; } next_n = 0; } tempkn = k == A.nt-1 ? A.n-k*A.nb : A.nb; tempmn = m == A.nt-1 ? A.n-m*A.nb : A.nb; ldak = BLKLDD(A, k); ldan = BLKLDD(A, n); ldam = BLKLDD(A, m); if (m == k) { if (n == k) { /* * PlasmaLower */ if (uplo == PlasmaLower) { CORE_spotrf( PlasmaLower, tempkn, A(k, k), ldak, &info); } /* * PlasmaUpper */ else { CORE_spotrf( PlasmaUpper, tempkn, A(k, k), ldak, &info); } if (info != 0) { plasma_request_fail(sequence, request, info + A.nb*k); ss_abort(); } ss_cond_set(k, k, 1); } else { ss_cond_wait(k, n, 1); /* * PlasmaLower */ if (uplo == PlasmaLower) { CORE_ssyrk( PlasmaLower, PlasmaNoTrans, tempkn, A.nb, -1.0, A(k, n), ldak, 1.0, A(k, k), ldak); } /* * PlasmaUpper */ else { CORE_ssyrk( PlasmaUpper, PlasmaTrans, tempkn, A.nb, -1.0, A(n, k), ldan, 1.0, A(k, k), ldak); } } } else { if (n == k) { ss_cond_wait(k, k, 1); /* * PlasmaLower */ if (uplo == PlasmaLower) { CORE_strsm( PlasmaRight, PlasmaLower, PlasmaTrans, PlasmaNonUnit, tempmn, A.nb, zone, A(k, k), ldak, A(m, k), ldam); } /* * PlasmaUpper */ else { CORE_strsm( PlasmaLeft, PlasmaUpper, PlasmaTrans, PlasmaNonUnit, A.nb, tempmn, zone, A(k, k), ldak, A(k, m), ldak); } ss_cond_set(m, k, 1); } else { ss_cond_wait(k, n, 1); ss_cond_wait(m, n, 1); /* * PlasmaLower */ if (uplo == PlasmaLower) { CORE_sgemm( PlasmaNoTrans, PlasmaTrans, tempmn, A.nb, A.nb, mzone, A(m, n), ldam, A(k, n), ldak, zone, A(m, k), ldam); } /* * PlasmaUpper */ else { CORE_sgemm( PlasmaTrans, PlasmaNoTrans, A.nb, tempmn, A.nb, mzone, A(n, k), ldan, A(n, m), ldan, zone, A(k, m), ldak); } } } n = next_n; m = next_m; k = next_k; } ss_finalize(); }