1 /*****************************************************************************
2 Copyright (c) 2011-2014, The OpenBLAS Project
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 1. Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in
14 the documentation and/or other materials provided with the
15 distribution.
16 3. Neither the name of the OpenBLAS project nor the names of
17 its contributors may be used to endorse or promote products
18 derived from this software without specific prior written
19 permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
30 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 **********************************************************************************/
33
34 #include "common.h"
35
36 #include <string.h>
37
38 static char* openblas_config_str=""
39 "OpenBLAS "
40 VERSION
41 " "
42 #ifdef USE64BITINT
43 " USE64BITINT "
44 #endif
45 #ifdef NO_CBLAS
46 "NO_CBLAS "
47 #endif
48 #ifdef NO_LAPACK
49 "NO_LAPACK "
50 #endif
51 #ifdef NO_LAPACKE
52 "NO_LAPACKE "
53 #endif
54 #ifdef DYNAMIC_ARCH
55 "DYNAMIC_ARCH "
56 #endif
57 #ifdef NO_AFFINITY
58 "NO_AFFINITY "
59 #endif
60 #ifdef USE_OPENMP
61 "USE_OPENMP "
62 #endif
63 #ifndef DYNAMIC_ARCH
64 CHAR_CORENAME
65 #endif
66 ;
67
68 #ifdef DYNAMIC_ARCH
69 char *gotoblas_corename();
70 #endif
71
72 static char tmp_config_str[256];
73 int openblas_get_parallel();
74
CNAME()75 char* CNAME() {
76 char tmpstr[20];
77 strcpy(tmp_config_str, openblas_config_str);
78 #ifdef DYNAMIC_ARCH
79 strcat(tmp_config_str, gotoblas_corename());
80 #endif
81 if (openblas_get_parallel() == 0)
82 sprintf(tmpstr, " SINGLE_THREADED");
83 else
84 snprintf(tmpstr,19," MAX_THREADS=%d",MAX_CPU_NUMBER);
85 strcat(tmp_config_str, tmpstr);
86 return tmp_config_str;
87 }
88
89
openblas_get_corename()90 char* openblas_get_corename() {
91 #ifndef DYNAMIC_ARCH
92 return CHAR_CORENAME;
93 #else
94 return gotoblas_corename();
95 #endif
96 }
97
98