Merge pull request #3073 from xoviat/embedded

add embedded option
This commit is contained in:
Martin Kroeker 2021-01-31 18:02:41 +01:00 committed by GitHub
commit 0cc36770f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 5 deletions

1
.gitignore vendored
View File

@ -91,3 +91,4 @@ benchmark/*.goto
benchmark/smallscaling benchmark/smallscaling
CMakeCache.txt CMakeCache.txt
CMakeFiles/* CMakeFiles/*
.vscode

View File

@ -212,7 +212,8 @@ Please note that it is not possible to combine support for different architectur
- **Android**: Supported by the community. Please read <https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android>. - **Android**: Supported by the community. Please read <https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android>.
- **AIX**: Supported on PPC up to POWER8 - **AIX**: Supported on PPC up to POWER8
- **Haiku**: Supported by the community. We don't actively test the library on this OS. - **Haiku**: Supported by the community. We don't actively test the library on this OS.
- **SunOS**: Supported by the community. We don't actively test the library on this OS: - **SunOS**: Supported by the community. We don't actively test the library on this OS.
- **Cortex-M**: Supported by the community. Please read <https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-on-Cortex-M>.
## Usage ## Usage

View File

@ -233,6 +233,11 @@ if (BINARY64)
endif () endif ()
endif () endif ()
if(EMBEDDED)
set(CCOMMON_OPT "${CCOMMON_OPT} -DOS_EMBEDDED")
set(CCOMMON_OPT "${CCOMMON_OPT} -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16")
endif()
if (NEED_PIC) if (NEED_PIC)
if (${CMAKE_C_COMPILER} STREQUAL "IBM") if (${CMAKE_C_COMPILER} STREQUAL "IBM")
set(CCOMMON_OPT "${CCOMMON_OPT} -qpic=large") set(CCOMMON_OPT "${CCOMMON_OPT} -qpic=large")

View File

@ -122,7 +122,7 @@ extern "C" {
#define ATOM GOTO_ATOM #define ATOM GOTO_ATOM
#undef GOTO_ATOM #undef GOTO_ATOM
#endif #endif
#else #elif !defined(OS_EMBEDDED)
#include <sys/mman.h> #include <sys/mman.h>
#ifndef NO_SYSV_IPC #ifndef NO_SYSV_IPC
#include <sys/shm.h> #include <sys/shm.h>
@ -134,6 +134,9 @@ extern "C" {
#if defined(SMP) || defined(USE_LOCKING) #if defined(SMP) || defined(USE_LOCKING)
#include <pthread.h> #include <pthread.h>
#endif #endif
#else
#include <time.h>
#include <math.h>
#endif #endif
#if defined(OS_SUNOS) #if defined(OS_SUNOS)
@ -488,10 +491,12 @@ static inline unsigned long long rpcc(void){
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);
return (unsigned long long)ts.tv_sec * 1000000000ull + ts.tv_nsec; return (unsigned long long)ts.tv_sec * 1000000000ull + ts.tv_nsec;
#else #elif !defined(OS_EMBEDDED)
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
return (unsigned long long)tv.tv_sec * 1000000000ull + tv.tv_usec * 1000; return (unsigned long long)tv.tv_sec * 1000000000ull + tv.tv_usec * 1000;
#else
return 0;
#endif #endif
} }
#define RPCC_DEFINED #define RPCC_DEFINED
@ -521,6 +526,10 @@ static void __inline blas_lock(volatile BLASULONG *address){
#include "common_linux.h" #include "common_linux.h"
#endif #endif
#ifdef OS_EMBEDDED
#define DTB_DEFAULT_ENTRIES 64
#endif
#define MMAP_ACCESS (PROT_READ | PROT_WRITE) #define MMAP_ACCESS (PROT_READ | PROT_WRITE)
#ifdef __NetBSD__ #ifdef __NetBSD__

View File

@ -1668,16 +1668,23 @@ void gotoblas_dummy_for_PGI(void) {
#ifndef MEM_LARGE_PAGES #ifndef MEM_LARGE_PAGES
#define MEM_LARGE_PAGES 0x20000000 #define MEM_LARGE_PAGES 0x20000000
#endif #endif
#else #elif !defined(OS_EMBEDDED)
#define ALLOC_MMAP #define ALLOC_MMAP
#define ALLOC_MALLOC #define ALLOC_MALLOC
#else
#define ALLOC_MALLOC
inline int puts(const char *str) { return 0; }
inline int printf(const char *format, ...) { return 0; }
inline char *getenv(const char *name) { return ""; }
inline int atoi(const char *str) { return 0; }
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#if !defined(OS_WINDOWS) || defined(OS_CYGWIN_NT) #if (!defined(OS_WINDOWS) || defined(OS_CYGWIN_NT)) && !defined(OS_EMBEDDED)
#include <sys/mman.h> #include <sys/mman.h>
#ifndef NO_SYSV_IPC #ifndef NO_SYSV_IPC
#include <sys/shm.h> #include <sys/shm.h>