Skip to content

Commit 443ef78

Browse files
committed
Added hermit support
1 parent 11ce79a commit 443ef78

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

Makefile.rule

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ VERSION = 0.3.30.dev
1717

1818
# You can specify the target architecture, otherwise it's
1919
# automatically detected.
20-
# TARGET = PENRYN
20+
#TARGET = X86_64
2121

2222
# If you want to support multiple architecture in one binary
2323
# DYNAMIC_ARCH = 1
@@ -29,10 +29,10 @@ VERSION = 0.3.30.dev
2929

3030
# C compiler including binary type(32bit / 64bit). Default is gcc.
3131
# Don't use Intel Compiler or PGI, it won't generate right codes as I expect.
32-
# CC = gcc
32+
CC = x86_64-hermit-gcc
3333

3434
# Fortran compiler. Default is g77.
35-
# FC = gfortran
35+
FC = x86_64-hermit-gfortran
3636

3737
# Even you can specify cross compiler. Meanwhile, please set HOSTCC.
3838

@@ -50,12 +50,12 @@ VERSION = 0.3.30.dev
5050

5151

5252
# If you use the cross compiler, please set this host compiler.
53-
# HOSTCC = gcc
53+
HOSTCC = gcc
5454

5555
# If you need 32bit binary, define BINARY=32, otherwise define BINARY=64
5656
# Please note that AVX is not available on 32-bit.
5757
# Setting BINARY=32 disables AVX/AVX2/AVX-512.
58-
# BINARY=64
58+
BINARY=64
5959

6060
# About threaded BLAS. It will be automatically detected if you don't
6161
# specify it.
@@ -115,7 +115,7 @@ VERSION = 0.3.30.dev
115115
# NO_STATIC = 1
116116

117117
# If you don't need to generate the shared library, please comment this in.
118-
# NO_SHARED = 1
118+
NO_SHARED = 1
119119

120120
# If you don't need the CBLAS interface, please comment this in.
121121
# NO_CBLAS = 1
@@ -264,7 +264,7 @@ NO_AFFINITY = 1
264264
# FCOMMON_OPT = -frecursive
265265

266266
# Profiling flags
267-
COMMON_PROF = -pg
267+
#COMMON_PROF = -pg
268268

269269
# Build Debug version
270270
# DEBUG = 1

ctest.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ OS_LINUX
109109
OS_HAIKU
110110
#endif
111111

112+
#if defined(__hermit__)
113+
OS_HERMIT
114+
#endif
115+
112116
#if defined(__i386) || defined(_X86)
113117
ARCH_X86
114118
#endif

driver/others/blas_server.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7878
#include <sys/time.h>
7979
#endif
8080

81+
82+
#if defined(OS_HERMIT) || defined(__hermit__)
83+
#include <errno.h>
84+
/*#include <signal.h>*/
85+
#include <sys/resource.h>
86+
#include <sys/time.h>
87+
#endif
88+
8189
#ifndef likely
8290
#ifdef __GNUC__
8391
#define likely(x) __builtin_expect(!!(x), 1)

driver/others/memory.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,14 @@ int get_num_procs(void) {
329329
}
330330
#endif
331331

332+
#if defined(__hermit__)
333+
extern long sys_get_processor_count();
334+
335+
int get_num_procs(void) {
336+
return sys_get_processor_count();
337+
}
338+
#endif
339+
332340
#ifdef OS_AIX
333341
int get_num_procs(void) {
334342
static int nums = 0;
@@ -438,7 +446,7 @@ void openblas_fork_handler(void)
438446
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60035
439447
// In the mean time build with USE_OPENMP=0 or link against another
440448
// implementation of OpenMP.
441-
#if !((defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT)) || defined(OS_ANDROID)) && defined(SMP_SERVER)
449+
#if !((defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT)) || defined(OS_ANDROID) || defined(__hermit__)) && defined(SMP_SERVER)
442450
int err;
443451
err = pthread_atfork ((void (*)(void)) BLASFUNC(blas_thread_shutdown), NULL, blas_memory_init);
444452
if(err != 0)
@@ -1904,6 +1912,15 @@ int get_num_procs(void) {
19041912
}
19051913
#endif
19061914

1915+
#if defined(__hermit__)
1916+
extern long sys_get_processor_count();
1917+
1918+
int get_num_procs(void) {
1919+
return sys_get_processor_count();
1920+
}
1921+
#endif
1922+
1923+
19071924
#ifdef OS_AIX
19081925
int get_num_procs(void) {
19091926
static int nums = 0;
@@ -2009,7 +2026,7 @@ void openblas_fork_handler(void)
20092026
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60035
20102027
// In the mean time build with USE_OPENMP=0 or link against another
20112028
// implementation of OpenMP.
2012-
#if !((defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT)) || defined(OS_ANDROID)) && defined(SMP_SERVER)
2029+
#if !((defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT)) || defined(OS_ANDROID) || defined(__hermit__)) && defined(SMP_SERVER)
20132030
int err;
20142031
err = pthread_atfork ((void (*)(void)) BLASFUNC(blas_thread_shutdown), NULL, NULL);
20152032
if(err != 0)

0 commit comments

Comments
 (0)