Skip to content

Commit 31d3031

Browse files
authored
Merge pull request #72 from xianyi/develop
rebase
2 parents d8e2edf + fcfb7ff commit 31d3031

File tree

13 files changed

+54
-12
lines changed

13 files changed

+54
-12
lines changed

Makefile.system

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ DYNAMIC_CORE += POWER8
617617
ifneq ($(C_COMPILER), GCC)
618618
DYNAMIC_CORE += POWER9
619619
DYNAMIC_CORE += POWER10
620+
override LDFLAGS += -Wl,-no-power10-stubs
620621
endif
621622
ifeq ($(C_COMPILER), GCC)
622623
ifeq ($(GCCVERSIONGT5), 1)
@@ -626,9 +627,11 @@ $(info, OpenBLAS: Your gcc version is too old to build the POWER9 kernels.)
626627
endif
627628
ifeq ($(GCCVERSIONGTEQ11), 1)
628629
DYNAMIC_CORE += POWER10
629-
else ifeq ($(GCCVERSIONEQ10), 1)
630+
override LDFLAGS += -Wl,-no-power10-stubs
631+
else ifeq ($(GCCVERSIONGTEQ10), 1)
630632
ifeq ($(GCCMINORVERSIONGTEQ2), 1)
631633
DYNAMIC_CORE += POWER10
634+
override LDFLAGS += -Wl,-no-power10-stubs
632635
endif
633636
else
634637
$(info, OpenBLAS: Your gcc version is too old to build the POWER10 kernels.)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Examples:
5858
```sh
5959
make BINARY=64 CC=mips64el-unknown-linux-gnu-gcc FC=mips64el-unknown-linux-gnu-gfortran HOSTCC=gcc TARGET=LOONGSON3A
6060
```
61+
or same with the newer mips-crosscompiler put out by Loongson that defaults to the 32bit ABI:
62+
```sh
63+
make HOSTCC=gcc CC='/opt/mips-loongson-gcc7.3-linux-gnu/2019.06-29/bin/mips-linux-gnu-gcc -mabi=64' FC='/opt/mips-loongson-gcc7.3-linux-gnu/2019.06-29/bin/mips-linux-gnu-gfortran -mabi=64' TARGET=LOONGSON3A
64+
```
6165

6266
* On an x86 box, compile this library for a loongson3a CPU with loongcc (based on Open64) compiler:
6367
```sh

c_check

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,28 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
249249
}
250250
}
251251

252+
$c11_atomics = 0;
253+
if ($data =~ /HAVE_C11/) {
254+
eval "use File::Temp qw(tempfile)";
255+
if ($@){
256+
warn "could not load PERL module File::Temp, so could not check compiler compatibility with C11";
257+
$c11_atomics = 0;
258+
} else {
259+
($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
260+
print $tmpf "#include <stdatomic.h>\nint main(void){}\n";
261+
$args = " -c -o $tmpf.o $tmpf";
262+
my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null");
263+
system(@cmd) == 0;
264+
if ($? != 0) {
265+
$c11_atomics = 0;
266+
} else {
267+
$c11_atomics = 1;
268+
}
269+
unlink("$tmpf.o");
270+
}
271+
}
272+
273+
252274
$data = `$compiler_name $flags -S ctest1.c && grep globl ctest1.s | head -n 1 && rm -f ctest1.s`;
253275

254276
$data =~ /globl\s([_\.]*)(.*)/;
@@ -352,6 +374,8 @@ print CONFFILE "#define __32BIT__\t1\n" if $binformat eq bin32;
352374
print CONFFILE "#define __64BIT__\t1\n" if $binformat eq bin64;
353375
print CONFFILE "#define FUNDERSCORE\t$need_fu\n" if $need_fu ne "";
354376
print CONFFILE "#define HAVE_MSA\t1\n" if $have_msa eq 1;
377+
print CONFFILE "#define HAVE_C11\t1\n" if $c11_atomics eq 1;
378+
355379

356380
if ($os eq "LINUX") {
357381

cmake/f_check.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
# NEED2UNDERSCORES
2222

2323
if (NOT NO_LAPACK)
24-
enable_language(Fortran)
24+
include(CheckLanguage)
25+
check_language(Fortran)
26+
if(CMAKE_Fortran_COMPILER)
27+
enable_language(Fortran)
28+
else()
29+
message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK")
30+
set (NOFORTRAN 1)
31+
set (NO_LAPACK 1)
32+
endif()
2533
else()
2634
include(CMakeForceCompiler)
2735
CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)

common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ __declspec(dllimport) int __cdecl omp_in_parallel(void);
681681
__declspec(dllimport) int __cdecl omp_get_num_procs(void);
682682
#endif
683683

684-
#if (__STDC_VERSION__ >= 201112L)
684+
#ifdef HAVE_C11
685685
#if defined(C_GCC) && ( __GNUC__ < 7)
686686
// workaround for GCC bug 65467
687687
#ifndef _Atomic

ctest.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,6 @@ ARCH_ARM
153153
ARCH_ARM64
154154
#endif
155155

156+
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
157+
HAVE_C11
158+
#endif

driver/level3/level3_gemm3m_thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#endif
9292

9393
typedef struct {
94-
#if __STDC_VERSION__ >= 201112L
94+
#ifdef HAVE_C11
9595
_Atomic
9696
#else
9797
volatile

driver/level3/level3_syrk_threaded.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#endif
6868

6969
typedef struct {
70-
#if __STDC_VERSION__ >= 201112L
70+
#ifdef HAVE_C11
7171
_Atomic
7272
#else
7373
volatile

driver/others/blas_server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ typedef struct {
141141

142142
} thread_status_t;
143143

144-
#if (__STDC_VERSION__ >= 201112L)
144+
#ifdef HAVE_C11
145145
#define atomic_load_queue(p) __atomic_load_n(p, __ATOMIC_RELAXED)
146146
#define atomic_store_queue(p, v) __atomic_store_n(p, v, __ATOMIC_RELAXED)
147147
#else

driver/others/blas_server_omp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
int blas_server_avail = 0;
5656

5757
static void * blas_thread_buffer[MAX_PARALLEL_NUMBER][MAX_CPU_NUMBER];
58-
#if __STDC_VERSION__ >= 201112L
58+
#ifdef HAVE_C11
5959
static atomic_bool blas_buffer_inuse[MAX_PARALLEL_NUMBER];
6060
#else
6161
static _Bool blas_buffer_inuse[MAX_PARALLEL_NUMBER];
@@ -320,7 +320,7 @@ int exec_blas(BLASLONG num, blas_queue_t *queue){
320320

321321
while(true) {
322322
for(i=0; i < MAX_PARALLEL_NUMBER; i++) {
323-
#if __STDC_VERSION__ >= 201112L
323+
#ifdef HAVE_C11
324324
_Bool inuse = false;
325325
if(atomic_compare_exchange_weak(&blas_buffer_inuse[i], &inuse, true)) {
326326
#else
@@ -345,7 +345,7 @@ int exec_blas(BLASLONG num, blas_queue_t *queue){
345345
exec_threads(&queue[i], buf_index);
346346
}
347347

348-
#if __STDC_VERSION__ >= 201112L
348+
#ifdef HAVE_C11
349349
atomic_store(&blas_buffer_inuse[buf_index], false);
350350
#else
351351
blas_buffer_inuse[buf_index] = false;

0 commit comments

Comments
 (0)