|
PLASMA
2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
|
#include <stdlib.h>#include <stdio.h>#include <math.h>#include <string.h>#include "common.h"#include "primes.h"#include "gkkleader.h"
Go to the source code of this file.
Macros | |
| #define | GCAND_SIZE 46 |
Functions | |
| int | GKK_doublingtable (int x, int m, int emax, int *dt) |
| int | GKK_modpow (int *dt, int e, int m) |
| int | GKK_primroot (int p, int e, primedec_t *pr_p1, int t_p1) |
| int | GKK_multorder (int n, int p, int e, int pe, primedec_t *pr_p1, int t_p1) |
| void | GKK_prepare (int q, int n, primedec_t *pr_q, int *t, primedec_t **pr_pi1, int *t_pi1, int *gi, int *Nif, int *Kif, int *dif) |
| void | GKK_L (int t, primedec_t *pr_q, int *fi, int *Kif, int *dif, int *Li, int *diLi, int *cl, int *nl) |
| void | GKK_precompute_terms (int q, primedec_t *pr_q, int t, int *gi, int *diLi, int *rp, int *Mg, int nMg) |
| void | GKK_BalanceLoad (int thrdnbr, int *Tp, int *leaders, int nleaders, int L) |
| void | GKK_output_tables (int m, int n, int q, primedec_t *pr_q, int t, int *gi, int *Nif, int *Kif, int *dif) |
| int | GKK_getLeaderNbr (int me, int ne, int *nleaders, int **leaders) |
PLASMA InPlaceTransformation module PLASMA is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver
This work is the implementation of an inplace transformation based on the GKK algorithm by Gustavson, Karlsson, Kagstrom and its fortran implementation.
Definition in file gkkleader.c.
| #define GCAND_SIZE 46 |
GKK_primroot finds a primitive root of p^e, given the prime decomposition of p-1.
| [in] | p | |
| [in] | e | |
| [in] | pr_p1 | Prime decomposition of p - 1 |
| [in] | t_p1 | Number of primes in prime decomposition of p-1 |
| A | primitive root of p^e |
Definition at line 149 of file gkkleader.c.
| void GKK_BalanceLoad | ( | int | thrdnbr, |
| int * | Tp, | ||
| int * | leaders, | ||
| int | nleaders, | ||
| int | L | ||
| ) |
GKK_BalanceLoad balances the load by splitting across some cycles.
| [in] | thrdnbr | number of thread working on cycles |
| [in,out] | Tp | Array of size thrdnbr. Work load for each thread. |
| [in,out] | leaders | Array of size nleaders containing leaders, cycles length and owners |
| [in] | nleaders | Number of leaders stored multiplied by 3 |
| [in] | L | Chunk size to compute the load balancing |
Definition at line 636 of file gkkleader.c.
References IMBALANCE_THRESHOLD, L, maxval(), min, and sum().


| int GKK_doublingtable | ( | int | x, |
| int | m, | ||
| int | emax, | ||
| int * | dt | ||
| ) |
GKK_doublingtable Computes a table of x^i mod m for i = 1, 2, 4, 8, ..., emax
| [in] | x | |
| [in] | m | |
| [in] | emax | Maximum power to compute |
| [out] | dt | On exit, dt contains (x^1 mod m, x^2 mod m, x^4 mod m, ..., x^emax mod m) |
Definition at line 47 of file gkkleader.c.
References PLASMA_ERR_OUT_OF_RESOURCES, plasma_error(), PLASMA_SUCCESS, and PWR_MAXSIZE.


| int GKK_getLeaderNbr | ( | int | me, |
| int | ne, | ||
| int * | nleaders, | ||
| int ** | leaders | ||
| ) |
Definition at line 753 of file gkkleader.c.
References primedec::e, GKK_L(), GKK_output_tables(), GKK_precompute_terms(), GKK_prepare(), primedec::p, primedec::pe, PLASMA_SUCCESS, PRIME_MAXSIZE, PWR_MAXSIZE, and SIZE_MG.


| void GKK_L | ( | int | t, |
| primedec_t * | pr_q, | ||
| int * | fi, | ||
| int * | Kif, | ||
| int * | dif, | ||
| int * | Li, | ||
| int * | diLi, | ||
| int * | cl, | ||
| int * | nl | ||
| ) |
GKK_L computes Li, cycle length cl, and number of leaders nl.
| [in] | t | Number of primes in prime decomposition of q |
| [in] | pr_q | Prime Decomposition of q |
| [in] | fi | Array of dimension PWR_MAXSIZE |
| [in] | Kif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE Stores the multiplicative order of n modulo pi^ei |
| [in] | dif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE dif(i,j) = Nif(i,j) / Kif(i,j) |
| [out] | Li | Array of dimension PWR_MAXSIZE |
| [out] | diLi | Array of dimension PWR_MAXSIZE diLi(i) = di(i) * Li (i) (bound for the leaders sets) |
| [out] | cl | Cycle length |
| [out] | nl | Number of leaders |
Definition at line 462 of file gkkleader.c.
References gcd(), and PWR_MAXSIZE.


| int GKK_modpow | ( | int * | dt, |
| int | e, | ||
| int | m | ||
| ) |
GKK_modpow computes x^e mod m, like the modpow function. Unlike modpow, x is given implicitly via its doubling table dt.
| [in] | dt | Array of x^i mod m. |
| [in] | e | |
| [in] | m |
| x^e | mod m |
Definition at line 102 of file gkkleader.c.

| int GKK_multorder | ( | int | n, |
| int | p, | ||
| int | e, | ||
| int | pe, | ||
| primedec_t * | pr_p1, | ||
| int | t_p1 | ||
| ) |
GKK_multorder finds the multiplicative order of n modulo p^e = pe, given the prime decomposition of p-1.
| [in] | n | |
| [in] | p | |
| [in] | e | |
| [in] | pe | |
| [in,out] | pr_p1 | On entry, prime decomposition of p - 1 On exit, prime decomposition of p - 1 and p^(e-1) appends at the end |
| [in] | t_p1 | Number of primes in prime decomposition of p-1 |
| the | multiplicative order of n modulo p^e = pe |
Definition at line 232 of file gkkleader.c.
References primedec::e, GKK_doublingtable(), GKK_modpow(), primedec::p, primedec::pe, PRIME_MAXSIZE, and PWR_MAXSIZE.


| void GKK_output_tables | ( | int | m, |
| int | n, | ||
| int | q, | ||
| primedec_t * | pr_q, | ||
| int | t, | ||
| int * | gi, | ||
| int * | Nif, | ||
| int * | Kif, | ||
| int * | dif | ||
| ) |
GKK_output_tables prints information from the heart of the GKK algorithm in a human friendly format.
| [in] | m | |
| [in] | n | |
| [in] | q | |
| [in] | pr_q | Prime Decomposition of q |
| [in] | t | Number of primes in prime decomposition of q |
| [in] | gi | Array of size PRIME_MAXSIZE Stores prime root of each pi^ei |
| [in] | Nif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE Stores the Phi(pi^fi) with fi in (1 .. ei) |
| [in] | Kif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE Stores the multiplicative order of n modulo pi^ei |
| [in] | dif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE dif(i,j) = Nif(i,j) / Kif(i,j) |
Definition at line 707 of file gkkleader.c.
References primedec::e, lapack_testing::f, and PWR_MAXSIZE.

| void GKK_precompute_terms | ( | int | q, |
| primedec_t * | pr_q, | ||
| int | t, | ||
| int * | gi, | ||
| int * | diLi, | ||
| int * | rp, | ||
| int * | Mg, | ||
| int | nMg | ||
| ) |
GKK_precompute_terms Precompute M*g^i mod q.
| [in] | q | |
| [in] | pr_q | Prime Decomposition of q |
| [in] | t | Number of primes in prime decomposition of q |
| [in] | gi | Array of dimension PWR_MAXSIZE |
| [in] | diLi | Array of dimension PWR_MAXSIZE |
| [out] | rp | Array of dimension PWR_MAXSIZE rp(i) = sum(diLi(i), i=0..i-1), rp(0) = 0; |
| [out] | Mg | Array of dimension nMg |
| [in] | nMg |
Definition at line 563 of file gkkleader.c.
References primedec::pe, and plasma_error().


| void GKK_prepare | ( | int | q, |
| int | n, | ||
| primedec_t * | pr_q, | ||
| int * | t, | ||
| primedec_t ** | pr_pi1, | ||
| int * | t_pi1, | ||
| int * | gi, | ||
| int * | Nif, | ||
| int * | Kif, | ||
| int * | dif | ||
| ) |
GKK_prepare Prepare for the generation of leaders.
| [in] | q | = mn - 1 |
| [in] | n | |
| [out] | pr_q | Prime Decomposition of q |
| [out] | t | Number of primes in prime decomposition of q |
| [out] | pr_pi1 | Array of prime decompositions of each pi in prime decomposition of q |
| [out] | t_pi1 | Array of number of primes in each prime decomposition of pi found in prime decomposition of q |
| [out] | gi | Array of size PRIME_MAXSIZE Stores prime root of each pi^ei |
| [out] | Nif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE Stores the Phi(pi^fi) with fi in (1 .. ei) Phi(k) is the number of positive integers less than or equal to k which are coprime to k. |
| [out] | Kif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE Stores the multiplicative order of n modulo pi^ei |
| [out] | dif | Array of dimension PWR_MAXSIZE*PRIME_MAXSIZE dif(i,j) = Nif(i,j) / Kif(i,j) |
Definition at line 318 of file gkkleader.c.
References primedec::e, lapack_testing::f, factor(), gcd(), GKK_multorder(), GKK_primroot(), primedec::p, and PWR_MAXSIZE.


| int GKK_primroot | ( | int | p, |
| int | e, | ||
| primedec_t * | pr_p1, | ||
| int | t_p1 | ||
| ) |
Definition at line 150 of file gkkleader.c.
References GCAND_SIZE, GKK_doublingtable(), GKK_modpow(), plasma_error(), and PWR_MAXSIZE.

