Merge pull request #2293 from martin-frbg/pr2288
Add support for NetBSD by adding it to the existing xBSD conditionals
This commit is contained in:
commit
7dc8a76f60
|
@ -129,7 +129,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN)
|
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -192,7 +192,7 @@ void goto_set_num_threads(int num_threads) {};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_SUNOS) || defined(OS_NETBSD)
|
#if defined(OS_LINUX) || defined(OS_SUNOS)
|
||||||
#ifndef NO_AFFINITY
|
#ifndef NO_AFFINITY
|
||||||
int get_num_procs(void);
|
int get_num_procs(void);
|
||||||
#else
|
#else
|
||||||
|
@ -312,7 +312,7 @@ int get_num_procs(void) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY)
|
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY)
|
||||||
|
|
||||||
int get_num_procs(void) {
|
int get_num_procs(void) {
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ extern int openblas_goto_num_threads_env();
|
||||||
extern int openblas_omp_num_threads_env();
|
extern int openblas_omp_num_threads_env();
|
||||||
|
|
||||||
int blas_get_cpu_number(void){
|
int blas_get_cpu_number(void){
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
int max_num;
|
int max_num;
|
||||||
#endif
|
#endif
|
||||||
int blas_goto_num = 0;
|
int blas_goto_num = 0;
|
||||||
|
@ -412,7 +412,7 @@ int blas_get_cpu_number(void){
|
||||||
|
|
||||||
if (blas_num_threads) return blas_num_threads;
|
if (blas_num_threads) return blas_num_threads;
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
max_num = get_num_procs();
|
max_num = get_num_procs();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ int blas_get_cpu_number(void){
|
||||||
else if (blas_omp_num > 0) blas_num_threads = blas_omp_num;
|
else if (blas_omp_num > 0) blas_num_threads = blas_omp_num;
|
||||||
else blas_num_threads = MAX_CPU_NUMBER;
|
else blas_num_threads = MAX_CPU_NUMBER;
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
if (blas_num_threads > max_num) blas_num_threads = max_num;
|
if (blas_num_threads > max_num) blas_num_threads = max_num;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1673,7 +1673,7 @@ void gotoblas_dummy_for_PGI(void) {
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN)
|
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1736,7 +1736,7 @@ void goto_set_num_threads(int num_threads) {};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_SUNOS) || defined(OS_NETBSD)
|
#if defined(OS_LINUX) || defined(OS_SUNOS)
|
||||||
#ifndef NO_AFFINITY
|
#ifndef NO_AFFINITY
|
||||||
int get_num_procs(void);
|
int get_num_procs(void);
|
||||||
#else
|
#else
|
||||||
|
@ -1855,7 +1855,7 @@ int get_num_procs(void) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY)
|
#if defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY)
|
||||||
|
|
||||||
int get_num_procs(void) {
|
int get_num_procs(void) {
|
||||||
|
|
||||||
|
@ -1945,7 +1945,7 @@ extern int openblas_goto_num_threads_env();
|
||||||
extern int openblas_omp_num_threads_env();
|
extern int openblas_omp_num_threads_env();
|
||||||
|
|
||||||
int blas_get_cpu_number(void){
|
int blas_get_cpu_number(void){
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
int max_num;
|
int max_num;
|
||||||
#endif
|
#endif
|
||||||
int blas_goto_num = 0;
|
int blas_goto_num = 0;
|
||||||
|
@ -1953,7 +1953,7 @@ int blas_get_cpu_number(void){
|
||||||
|
|
||||||
if (blas_num_threads) return blas_num_threads;
|
if (blas_num_threads) return blas_num_threads;
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
max_num = get_num_procs();
|
max_num = get_num_procs();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1977,7 +1977,7 @@ int blas_get_cpu_number(void){
|
||||||
else if (blas_omp_num > 0) blas_num_threads = blas_omp_num;
|
else if (blas_omp_num > 0) blas_num_threads = blas_omp_num;
|
||||||
else blas_num_threads = MAX_CPU_NUMBER;
|
else blas_num_threads = MAX_CPU_NUMBER;
|
||||||
|
|
||||||
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_WINDOWS) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || defined(OS_DRAGONFLY) || defined(OS_DARWIN) || defined(OS_ANDROID)
|
||||||
if (blas_num_threads > max_num) blas_num_threads = max_num;
|
if (blas_num_threads > max_num) blas_num_threads = max_num;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1201,7 +1201,7 @@ static int get_num_cores(void) {
|
||||||
|
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
int m[2], count;
|
int m[2], count;
|
||||||
size_t len;
|
size_t len;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1215,7 +1215,7 @@ static int get_num_cores(void) {
|
||||||
GetSystemInfo(&sysinfo);
|
GetSystemInfo(&sysinfo);
|
||||||
return sysinfo.dwNumberOfProcessors;
|
return sysinfo.dwNumberOfProcessors;
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
m[0] = CTL_HW;
|
m[0] = CTL_HW;
|
||||||
m[1] = HW_NCPU;
|
m[1] = HW_NCPU;
|
||||||
len = sizeof(int);
|
len = sizeof(int);
|
||||||
|
|
Loading…
Reference in New Issue