Coverage Report

Created: 2025-09-05 19:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/contrib/openblas/interface/lapack/getrf.c
Line
Count
Source
1
/*********************************************************************/
2
/* Copyright 2009, 2010 The University of Texas at Austin.           */
3
/* All rights reserved.                                              */
4
/*                                                                   */
5
/* Redistribution and use in source and binary forms, with or        */
6
/* without modification, are permitted provided that the following   */
7
/* conditions are met:                                               */
8
/*                                                                   */
9
/*   1. Redistributions of source code must retain the above         */
10
/*      copyright notice, this list of conditions and the following  */
11
/*      disclaimer.                                                  */
12
/*                                                                   */
13
/*   2. Redistributions in binary form must reproduce the above      */
14
/*      copyright notice, this list of conditions and the following  */
15
/*      disclaimer in the documentation and/or other materials       */
16
/*      provided with the distribution.                              */
17
/*                                                                   */
18
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
19
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
20
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
21
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
22
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
23
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
24
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
25
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
26
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
27
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
28
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
29
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
30
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
31
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
32
/*                                                                   */
33
/* The views and conclusions contained in the software and           */
34
/* documentation are those of the authors and should not be          */
35
/* interpreted as representing official policies, either expressed   */
36
/* or implied, of The University of Texas at Austin.                 */
37
/*********************************************************************/
38
39
#include <stdio.h>
40
#include "common.h"
41
#ifdef FUNCTION_PROFILE
42
#include "functable.h"
43
#endif
44
45
#ifdef XDOUBLE
46
#define ERROR_NAME "QGETRF"
47
#elif defined(DOUBLE)
48
0
#define ERROR_NAME "DGETRF"
49
#else
50
0
#define ERROR_NAME "SGETRF"
51
#endif
52
53
0
int NAME(blasint *M, blasint *N, FLOAT *a, blasint *ldA, blasint *ipiv, blasint *Info){
54
55
0
  blas_arg_t args;
56
57
0
  blasint info;
58
0
  FLOAT *buffer;
59
#ifdef PPC440
60
  extern
61
#endif
62
0
  FLOAT *sa, *sb;
63
64
0
  PRINT_DEBUG_NAME;
65
66
0
  args.m    = *M;
67
0
  args.n    = *N;
68
0
  args.a    = (void *)a;
69
0
  args.lda  = *ldA;
70
0
  args.c    = (void *)ipiv;
71
72
0
  info  =    0;
73
0
  if (args.lda < MAX(1,args.m)) info = 4;
74
0
  if (args.n   < 0)             info = 2;
75
0
  if (args.m   < 0)             info = 1;
76
0
  if (info) {
77
0
    BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME) - 1);
78
0
    *Info = - info;
79
0
    return 0;
80
0
  }
81
82
0
  *Info = 0;
83
0
  if (args.m == 0 || args.n == 0) return 0;
84
85
0
  IDEBUG_START;
86
87
0
  FUNCTION_PROFILE_START();
88
89
0
#ifndef PPC440
90
0
  buffer = (FLOAT *)blas_memory_alloc(1);
91
92
0
  sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
93
0
  sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
94
0
#endif
95
96
0
#ifdef SMP
97
0
  args.common = NULL;
98
99
#ifndef DOUBLE
100
  int nmax = 40000;
101
#else 
102
  int nmax = 10000;
103
#endif
104
0
  if (args.m*args.n <nmax) {
105
0
    args.nthreads = 1;
106
0
  } else {
107
0
    args.nthreads = num_cpu_avail(4);
108
0
    if ((args.m*args.n)/args.nthreads <nmax)
109
0
      args.nthreads = (args.m*args.n)/nmax;
110
0
  }
111
112
0
  if (args.nthreads == 1) {
113
0
#endif
114
115
0
  *Info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0);
116
117
0
#ifdef SMP
118
0
  } else {
119
120
0
    *Info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0);
121
0
  }
122
0
#endif
123
124
0
#ifndef PPC440
125
0
  blas_memory_free(buffer);
126
0
#endif
127
128
0
  FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.n,  2. / 3. * args.m * args.n * args.n);
129
130
0
  IDEBUG_END;
131
132
0
  return 0;
133
0
}
Unexecuted instantiation: sgetrf_
Unexecuted instantiation: dgetrf_