本文整理汇总了C++中ATL_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ ATL_assert函数的具体用法?C++ ATL_assert怎么用?C++ ATL_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ATL_assert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ATL_assert
void ATL_signal_tree
(
PT_TREE_T ROOT
)
{
/*
* Purpose
* =======
*
* ATL_signal_tree signals the end of the node function to its peer.
*
* Arguments
* =========
*
* ROOT (input) PT_TREE_T
* On entry, ROOT specifies the node emitting the signal.
*
* ---------------------------------------------------------------------
*/
/* ..
* .. Executable Statements ..
*
*/
ATL_assert(!pthread_mutex_lock ( &(ROOT->mutex) )); ROOT->count++;
ATL_assert(!pthread_cond_signal ( &(ROOT->cond) ));
ATL_assert(!pthread_mutex_unlock( &(ROOT->mutex) ));
/*
* End of ATL_signal_tree
*/
}
示例2: ATL_assert
static TYPE *DupMat(enum ATLAS_ORDER Order, int M, int N, TYPE *A, int lda,
int ldc)
/*
* returns a duplicate of the A matrix, with new leading dimension
*/
{
int i, j, M2;
const int ldc2 = (ldc SHIFT), lda2 = (lda SHIFT);
TYPE *C;
if (Order == CblasRowMajor)
{
i = M;
M = N;
N = i;
}
M2 = M SHIFT;
ATL_assert(ldc >= M);
C = malloc(ATL_MulBySize(ldc)*N);
ATL_assert(C);
for (j=0; j != N; j++)
{
for (i=0; i != M2; i++) C[i] = A[i];
C += ldc2;
A += lda2;
}
return(C-N*ldc2);
}
示例3: f77getrf
int f77getrf(const enum ATLAS_ORDER Order, const int M, const int N,
TYPE *A, const int lda, int *ipiv)
{
int i;
const int MN=Mmin(M,N);
#ifdef ATL_FunkyInts
const F77_INTEGER F77M=M, F77N=N, F77lda=lda;
F77_INTEGER info, *F77ipiv;
#else
int info;
#define F77M M
#define F77N N
#define F77lda lda
#define F77ipiv ipiv
#endif
#ifdef ATL_FunkyInts
F77ipiv = malloc(MN * sizeof(F77_INTEGER));
ATL_assert(F77ipiv);
#endif
ATL_assert(Order == AtlasColMajor);
F77GETRF(&F77M, &F77N, A, &F77lda, F77ipiv, &info);
#ifdef ATL_FunkyInts
for (i=0; i < MN; i++) ipiv[i] = F77ipiv[i] - 1;
free(F77ipiv);
#else
for (i=0; i < MN; i++) ipiv[i]--;
#endif
return(info);
}
示例4: PrintUsage
int *RoutNames2IntList(int nargs, char **args, int i)
{
int n, *iarr, k;
if (++i >= nargs)
PrintUsage(args[0], i, NULL);
n = atoi(args[i]);
ATL_assert(n > 0);
iarr = malloc(sizeof(int)*(n+1));
ATL_assert(iarr);
iarr[0] = n;
for (k=0; k < n; k++)
{
if (++i >= nargs)
PrintUsage(args[0], i, NULL);
if (!strcmp(args[i], "getrf") || !strcmp(args[i], "GETRF"))
iarr[k+1] = LAgetrf;
else if (!strcmp(args[i], "potrf") || !strcmp(args[i], "POTRF"))
iarr[k+1] = LApotrf;
else if (!strcmp(args[i], "geqrf") || !strcmp(args[i], "GEQRF"))
iarr[k+1] = LAgeqrf;
else if (!strcmp(args[i], "geqlf") || !strcmp(args[i], "GEQLF"))
iarr[k+1] = LAgeqrf;
else if (!strcmp(args[i], "gerqf") || !strcmp(args[i], "GERQF"))
iarr[k+1] = LAgeqrf;
else if (!strcmp(args[i], "gelqf") || !strcmp(args[i], "GELQF"))
iarr[k+1] = LAgeqrf;
else
PrintUsage(args[0], i, args[i]);
}
return(iarr);
}
示例5: GetFlopCount
double GetTimeWithReps_LU
(int mflopF, int lda, int M, int N, int nb, int Uplo, int Side, int flsizeKB)
{
double mflop, t0, t1, drep;
char *wrksets; /* working sets for kernel calls */
#ifdef TCPLX
const int lda2 = lda+lda;
#else
const int lda2 = lda;
#endif
size_t setsz, setszT; /* work set size in memory, and amnt of it touched */
size_t nrep; /* # of reps required to force mflopF flops */
size_t nset; /* # of working sets allocated */
int i;
/*
* Keep setsz a multiple of TYPE size for alignment reasons. LU only accesses
* M*N of matrix and all of IPIV.
*/
setsz = lda*N*ATL_sizeof +
((M*sizeof(int)+ATL_sizeof-1)/ATL_sizeof)*ATL_sizeof;
setszT = M*N*ATL_sizeof + M*sizeof(int);
mflop = GetFlopCount(LAgetrf, 0, M, N, 0, 0, CAN_NB);
/*
* Cannot reuse matrices (bogus to factor an already factored matrix), so we
* must take as our total memspace MAX(nrep,nset)*setsz
*/
ATL_assert(mflop > 0.0);
drep = (mflopF*1.0e6) / mflop;
nrep = (int)(drep+0.999999);
/*
* If cacheline flush doesn't work, then we must use this method
*/
#if ATL_LINEFLUSH
if (nrep < 2)
return(-1.0); /* do wt normal timer */
#else
nrep = (nrep >= 1) ? nrep : 1;
#endif
nset = (flsizeKB*1024+setszT-1)/setszT;
if (nset < nrep)
nset = nrep;
wrksets = malloc(nset * setsz);
ATL_assert(wrksets);
for (i=0; i < nset; i++)
Mjoin(PATL,gegen)(M, N, (TYPE*)(wrksets+i*setsz), lda, M*N+lda);
t0 = time00();
for (i=0; i < nrep; i++)
{
test_getrf(CblasColMajor, M, N, (TYPE*)(wrksets+i*setsz), lda,
(int*)(wrksets+i*setsz+lda*N*ATL_sizeof));
}
t1 = time00();
free(wrksets);
return((t1-t0)/((double)nrep));
}
示例6: DoCblk
/*
* computes (i,j) non-diagonal block of C
*/
static void DoCblk(const int rank, ATL_tsyrk_ammN_t *pd, TYPE *wC, int i, int j)
{
const ammkern_t amm = pd->amm_b1;
const unsigned int nkblks=pd->nkblks, bs=pd->blkszA, kb=pd->kb, NB=pd->nb;
unsigned int nmu, nnu, mb, nb;
const TYPE *wA, *wB, *wAn, *wBn;
TYPE *c;
int k;
if (!(pd->LOWER))
{
k = i;
i = j;
j = k;
}
if (j != pd->ndiag-1)
{
nnu = pd->nnu;
nb = pd->nb;
}
else
{
nnu = pd->nnuf;
nb = pd->nbf;
}
if (i != pd->ndiag-1)
{
nmu = pd->nmu;
mb = pd->nb;
}
else
{
nmu = pd->nmuf;
mb = pd->nbf;
}
wA = pd->wA + i*pd->panszA;
wB = pd->wAt + j*pd->panszA;
wA = pd->wA + i*pd->panszA;
wB = pd->wAt + j*pd->panszA;
wAn = wA + bs;
wBn = wB + bs;
#ifdef DEBUG2
if (!ATL_IsBitSetBV(pd->cpydonBV, i) || !ATL_IsBitSetBV(pd->cpydonBV, j))
fprintf(stderr, "%d: ndiag=%d, i=%d, j=%d\n", rank, pd->ndiag, i, j);
ATL_assert(ATL_IsBitSetBV(pd->cpydonBV, i));
ATL_assert(ATL_IsBitSetBV(pd->cpydonBV, j));
#endif
pd->ammK(nmu, nnu, pd->KB0, wA, wB, wC, wAn, wBn, wC);
for (k=1; k < nkblks; k++)
{
wA = wAn;
wB = wBn;
wAn += bs;
wBn += bs;
amm(nmu, nnu, kb, wA, wB, wC, wAn, wBn, wC);
}
pd->blk2c(mb, nb, *(pd->alpha), wC, *(pd->beta),
pd->C+ NB*(j*(size_t)(pd->ldc) + i), pd->ldc);
}
示例7: ATL_thread_join
int ATL_thread_join(ATL_thread_t *thr) /* waits on completion of thread */
{
#ifdef ATL_WINTHREADS
ATL_assert(WaitForSingleObject(thr->thrH, INFINITE) != WAIT_FAILED);
ATL_assert(CloseHandle(thr->thrH));
#elif defined(ATL_OMP_THREADS)
fprintf(stderr, "Cannot call thread_join using OpenMP!!\n");
ATL_assert(0); /* should never enter this rout when using OMP */
#else
ATL_assert(!pthread_join(thr->thrH, NULL));
#endif
return(0);
}
示例8: Mjoin
void Mjoin(Mjoin(Mjoin(PATL,syrk),UploNM),T)
(const int N, const int K, const void *valpha, const void *A, const int lda,
const void *vbeta, void *C, const int ldc)
{
void *vc;
TYPE *c;
#ifdef TREAL
const SCALAR alpha=*( (const SCALAR *)valpha );
const SCALAR beta =*( (const SCALAR *)vbeta );
const SCALAR one=1.0, zero=0.0;
#else
#define alpha valpha
const TYPE *beta=vbeta;
const TYPE one[2]={1.0,0.0}, zero[2]={0.0,0.0};
#endif
if (K > SYRK_Xover)
{
vc = malloc(ATL_Cachelen+ATL_MulBySize(N)*N);
ATL_assert(vc);
c = ATL_AlignPtr(vc);
CgemmTN(N, N, K, alpha, A, lda, A, lda, zero, c, N);
if ( SCALAR_IS_ONE(beta) ) Mjoin(syr_put,_b1)(N, c, beta, C, ldc);
else if ( SCALAR_IS_ZERO(beta) ) Mjoin(syr_put,_b0)(N, c, beta, C, ldc);
#ifdef TCPLX
else if ( SCALAR_IS_NONE(beta) )
Mjoin(syr_put,_bn1)(N, c, beta, C, ldc);
else if (beta[1] == *zero) Mjoin(syr_put,_bXi0)(N, c, beta, C, ldc);
#endif
else Mjoin(syr_put,_bX)(N, c, beta, C, ldc);
free(vc);
}
else Mjoin(PATL,refsyrk)(Uplo_, AtlasTrans, N, K, alpha, A, lda,
beta, C, ldc);
}
示例9: malloc
double *TimeOnCores(struct kmm_struct *kb)
{
struct kmm_struct *kp;
pthread_t *threads;
pthread_attr_t *attr;
cpu_set_t cpuset;
double *mflops;
int i, p;
p = kb->p;
kp = malloc(sizeof(struct kmm_struct)*p);
threads = malloc(sizeof(pthread_t)*p);
attr = malloc(sizeof(pthread_attr_t)*p);
mflops = malloc(sizeof(double)*p);
ATL_assert(kp && threads && attr && mflops);
for (i=0; i < p; i++)
{
memcpy(kp+i, kb, sizeof(struct kmm_struct));
kp[i].iam = i;
CPU_ZERO(&cpuset);
CPU_SET(kp->pids[i], &cpuset);
assert(!pthread_attr_setaffinity_np(attr+i, sizeof(cpuset), &cpuset));
pthread_create(threads+i, attr+i, TimeOnCore, kp+i);
}
for (i=0; i < p; i++)
{
pthread_join(threads[i], NULL);
mflops[i] = kp[i].mf;
}
free(kp->pids);
free(kp);
free(threads);
free(attr);
return(mflops);
}
示例10: Mjoin
void Mjoin(Mjoin(PATL,trmmL),ATLP)
(const int M, const int N, const void *valpha, const void *A, const int lda,
void *C, const int ldc)
{
#ifdef TREAL
const SCALAR alpha=*( (const SCALAR *)valpha );
const SCALAR one=1.0, zero=0.0;
#else
const TYPE zero[2]={0.0,0.0};
#define alpha valpha
#endif
void *va;
TYPE *a;
if (N > TRMM_Xover)
{
va = malloc(ATL_Cachelen + ATL_MulBySize(M)*M);
ATL_assert(va);
a = ATL_AlignPtr(va);
#ifdef TREAL
if ( SCALAR_IS_ONE(alpha) ) Mjoin(ATL_trcopy,_a1)(M, alpha, A, lda, a);
else Mjoin(ATL_trcopy,_aX)(M, alpha, A, lda, a);
CAgemmTN(M, N, M, one, a, M, C, ldc, zero, C, ldc);
#else
ATL_trcopy(M, A, lda, a);
CAgemmTN(M, N, M, valpha, a, M, C, ldc, zero, C, ldc);
#endif
free(va);
}
else Mjoin(PATL,reftrmm)(AtlasLeft, Uplo_, Trans_, Unit_, M, N, alpha,
A, lda, C, ldc);
}
示例11: Mjoin
void Mjoin(Mjoin(PATL,symmR),UploNM)
(const int M, const int N, const void *valpha, const void *A, const int lda,
const void *B, const int ldb, const void *vbeta, void *C, const int ldc)
{
#ifdef TREAL
const SCALAR alpha=*( (const SCALAR *)valpha );
const SCALAR beta =*( (const SCALAR *)vbeta );
const SCALAR one=1.0;
#else
#define alpha valpha
#define beta vbeta
#endif
void *va;
TYPE *a;
if (M > SYMM_Xover)
{
va = malloc(ATL_Cachelen + ATL_MulBySize(N)*N);
ATL_assert(va);
a = ATL_AlignPtr(va);
#ifdef TREAL
if ( SCALAR_IS_ONE(alpha) )
Mjoin(Mjoin(Mjoin(PATL,sycopy),UploNM),_a1)(N, alpha, A, lda, a);
else Mjoin(Mjoin(Mjoin(PATL,sycopy),UploNM),_aX)(N, alpha, A, lda, a);
ATL_ammm(AtlasNoTrans, AtlasNoTrans, M, N, N, one, B, ldb, a, N, beta, C, ldc);
#else
Mjoin(Mjoin(PATL,sycopy),UploNM)(N, A, lda, a);
ATL_ammm(AtlasNoTrans, AtlasNoTrans, M, N, N, valpha, B, ldb, a, N, vbeta, C, ldc);
#endif
free(va);
}
else Mjoin(PATL,refsymm)(AtlasRight, Uplo_, M, N, alpha, A, lda, B, ldb,
beta, C, ldc);
}
示例12: Mjoin
void Mjoin(Mjoin(Mjoin(PATL,herk),UploNM),N)
(const int N, const int K, const void *valpha, const void *A, const int lda,
const void *vbeta, void *C, const int ldc)
{
void *vc;
TYPE *c;
TYPE alpha[2];
const TYPE beta = *( (const TYPE *)vbeta );
const TYPE zero[2] = {0.0, 0.0};
alpha[0] = *( (const TYPE *)valpha );
if (K > HERK_Xover)
{
alpha[1] = 0.0;
vc = malloc(ATL_Cachelen+ATL_MulBySize(N)*N);
ATL_assert(vc);
c = ATL_AlignPtr(vc);
CgemmNC(N, N, K, alpha, A, lda, A, lda, zero, c, N);
if ( beta == 1.0 ) Mjoin(her_put,_b1)(N, c, vbeta, C, ldc);
else if ( beta == 0.0 ) Mjoin(her_put,_b0)(N, c, vbeta, C, ldc);
else Mjoin(her_put,_bXi0)(N, c, vbeta, C, ldc);
free(vc);
}
else Mjoin(PATL,refherk)(Uplo_, AtlasNoTrans, N, K, *alpha, A, lda,
beta, C, ldc);
}
示例13: Mjoin
void Mjoin(PATL,gpmm)
(const enum PACK_UPLO UA, const enum PACK_TRANS TA,
const enum PACK_UPLO UB, const enum PACK_TRANS TB, const enum PACK_UPLO UC,
const int M, const int N, const int K, const SCALAR alpha,
const TYPE *A, const int IA, const int JA, const int lda,
const TYPE *B, const int IB, const int JB, const int ldb,
const SCALAR beta, TYPE *C, const int IC, const int JC, const int ldc)
{
int j;
#ifdef CacheEdge
static const int CE_K = ((ATL_DivBySize(CacheEdge)-(NBNB SHIFT)) /
(NB*(NB+NB)))*NB;
#else
#define CE_K K
#endif
if (!M || !N) return;
if (!K || SCALAR_IS_ZERO(alpha))
{
for (j=0; j != N; j++)
Mjoin(PATL,scal)(M, beta, C+MindexP(UC,IC,JC+j,ldc), 1);
return;
}
/*
* Packed gpmm not yet implemented for complex,
* so die if not really a dense gemm
*/
#ifdef TCPLX
ATL_assert (UA == PackGen && UB == PackGen && UC == PackGen);
Mjoin(PATL,gemm)(TA, TB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc);
#else
Mjoin(PATL,prankK)(UA, TA, UB, TB, M, N, K, CE_K, alpha,
A+MindexP(UA,IA,JA,lda), Mpld(UA,JA,lda), B+MindexP(UB,IB,JB,ldb),
Mpld(UB,JB,ldb), beta, UC, C+MindexP(UC,IB,JB,ldc), Mpld(UC,JC,ldc));
#endif
}
示例14: f77gesv
int f77gesv(const int N, const int NRHS, TYPE *A, const int lda,
int *ipiv, TYPE *B, const int ldb)
{
#ifdef ATL_FunkyInts
const F77_INTEGER F77N=N, F77lda=lda, F77ldb=ldb, F77NRHS=NRHS;
F77_INTEGER info;
F77_INTEGER *F77ipiv;
#else
int info;
#define F77N N
#define F77NRHS NRHS
#define F77lda lda
#define F77ldb ldb
#define F77ipiv ipiv
#endif
int i;
#ifdef ATL_FunkyInts
F77ipiv = malloc(N*sizeof(F77_INTEGER));
ATL_assert(F77ipiv);
#endif
F77GESV(&F77N, &F77NRHS, A, &F77lda, F77ipiv, B, &F77ldb, &info);
#ifdef ATL_FunkyInts
for (i=0; i < N; i++) ipiv[i] = F77ipiv[i] - 1;
free(F77ipiv);
#else
for (i=0; i < N; i++) ipiv[i]--;
#endif
return(info);
}
示例15: malloc
static TYPE *ATL_LmulLt(const int N, const TYPE *L, const int ldl)
/*
* A = L * L^H
*/
{
const int incA = 1 SHIFT, incL = (ldl+1) SHIFT;
TYPE *A;
int i, j;
#ifdef TCPLX
int i1, i2;
TYPE tmp;
#endif
A = malloc(N*ATL_MulBySize(N));
ATL_assert(A);
for (j=0; j < N; j++)
{
for (i=j; i < N; i++)
{
#ifdef TREAL
A[i+j*N] = L[i+j*ldl] * L[j+j*ldl] +
Mjoin(PATL,dot)(j, L+i, ldl, L+j, ldl);
#else
tmp = L[(j+j*ldl)<<1];
i1 = (i + j * N)<<1;
i2 = (i + j * ldl)<<1;
Mjoin(PATL,dotc_sub)(j, L+(j<<1), ldl, L+(i<<1), ldl, A+i1);
A[i1] += L[i2] * tmp;
if (i != j) A[i1+1] += tmp * L[i2+1];
#endif
}
}
return(A);
}