diff --git a/Makefile.power b/Makefile.power index beb311945..ea84f5945 100644 --- a/Makefile.power +++ b/Makefile.power @@ -34,8 +34,11 @@ ifeq ($(USE_OPENMP), 1) COMMON_OPT += -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp FCOMMON_OPT += -O2 -frecursive -mcpu=power8 -mtune=power8 -malign-power -DUSE_OPENMP -fno-fast-math -fopenmp else -COMMON_OPT += -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -fno-fast-math -FCOMMON_OPT += -O2 -frecursive -mcpu=power8 -mtune=power8 -malign-power -fno-fast-math +COMMON_OPT += -Ofast -mcpu=power8 -mtune=power8 -mvsx -malign-power -fno-fast-math +FCOMMON_OPT += -O2 -frecursive -mcpu=power8 -mtune=power8 -malign-power -fno-fast-math +ifeq ($(OSNAME), AIX) +FCOMMON_OPT += -O1 -frecursive -mcpu=power8 -mtune=power8 -malign-power -fno-fast-math +endif endif endif @@ -78,6 +81,9 @@ CCOMMON_OPT += -mpowerpc64 -maix64 ifeq ($(COMPILER_F77), g77) FCOMMON_OPT += -mpowerpc64 -maix64 endif +ifeq ($(F_COMPILER), GFORTRAN) +FCOMMON_OPT += -mpowerpc64 -maix64 +endif ifeq ($(COMPILER_F77), xlf) FCOMMON_OPT += -q64 endif diff --git a/Makefile.system b/Makefile.system index 61ae264bf..4f17c25b9 100644 --- a/Makefile.system +++ b/Makefile.system @@ -109,6 +109,9 @@ endif ifeq ($(TARGET), ARMV8) GETARCH_FLAGS := -DFORCE_ARMV7 endif +ifeq ($(TARGET), POWER8) +GETARCH_FLAGS := -DFORCE_POWER6 +endif endif diff --git a/c_check b/c_check index 8234c2081..dd700b8b4 100644 --- a/c_check +++ b/c_check @@ -6,6 +6,7 @@ # Checking cross compile $hostos = `uname -s | sed -e s/\-.*//`; chop($hostos); $hostarch = `uname -m | sed -e s/i.86/x86/`;chop($hostarch); +$hostarch = `uname -p` if ($hostos eq "AIX"); $hostarch = "x86_64" if ($hostarch eq "amd64"); $hostarch = "arm" if ($hostarch =~ /^arm.*/); $hostarch = "arm64" if ($hostarch eq "aarch64"); diff --git a/cpuid_power.c b/cpuid_power.c index b36aa4945..8f578d68f 100644 --- a/cpuid_power.c +++ b/cpuid_power.c @@ -57,7 +57,7 @@ #define CPUTYPE_PPCG4 7 #define CPUTYPE_POWER8 8 #define CPUTYPE_POWER9 9 -#define CPUTYPE_POWER10 10 +#define CPUTYPE_POWER10 10 char *cpuname[] = { "UNKNOWN", @@ -83,8 +83,8 @@ char *lowercpuname[] = { "cell", "ppcg4", "power8", - "power9", - "power10" + "power9", + "power10" }; char *corename[] = { @@ -97,8 +97,8 @@ char *corename[] = { "CELL", "PPCG4", "POWER8", - "POWER9", - "POWER10" + "POWER9", + "POWER10" }; int detect(void){ @@ -154,17 +154,17 @@ int detect(void){ pclose(infile); - if (!strncasecmp(p, "POWER3", 6)) return CPUTYPE_POWER3; - if (!strncasecmp(p, "POWER4", 6)) return CPUTYPE_POWER4; - if (!strncasecmp(p, "PPC970", 6)) return CPUTYPE_PPC970; - if (!strncasecmp(p, "POWER5", 6)) return CPUTYPE_POWER5; - if (!strncasecmp(p, "POWER6", 6)) return CPUTYPE_POWER6; - if (!strncasecmp(p, "POWER7", 6)) return CPUTYPE_POWER6; - if (!strncasecmp(p, "POWER8", 6)) return CPUTYPE_POWER8; - if (!strncasecmp(p, "POWER9", 6)) return CPUTYPE_POWER9; - if (!strncasecmp(p, "POWER10", 7)) return CPUTYPE_POWER10; - if (!strncasecmp(p, "Cell", 4)) return CPUTYPE_CELL; - if (!strncasecmp(p, "7447", 4)) return CPUTYPE_PPCG4; + if (strstr(p, "POWER3")) return CPUTYPE_POWER3; + if (strstr(p, "POWER4")) return CPUTYPE_POWER4; + if (strstr(p, "PPC970")) return CPUTYPE_PPC970; + if (strstr(p, "POWER5")) return CPUTYPE_POWER5; + if (strstr(p, "POWER6")) return CPUTYPE_POWER6; + if (strstr(p, "POWER7")) return CPUTYPE_POWER6; + if (strstr(p, "POWER8")) return CPUTYPE_POWER8; + if (strstr(p, "POWER9")) return CPUTYPE_POWER9; + if (strstr(p, "POWER10")) return CPUTYPE_POWER10; + if (strstr(p, "Cell")) return CPUTYPE_CELL; + if (strstr(p, "7447")) return CPUTYPE_PPCG4; return CPUTYPE_POWER5; #endif diff --git a/getarch.c b/getarch.c index 164947f3e..2cdf77259 100644 --- a/getarch.c +++ b/getarch.c @@ -90,11 +90,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #endif +#if defined(AIX) +#include +#endif +#if defined(__x86_64__) || defined(_M_X64) #if (( defined(__GNUC__) && __GNUC__ > 6 && defined(__AVX2__)) || (defined(__clang__) && __clang_major__ >= 6)) #else #define NO_AVX512 #endif +#endif /* #define FORCE_P2 */ /* #define FORCE_KATMAI */ /* #define FORCE_COPPERMINE */ @@ -1297,6 +1302,11 @@ static int get_num_cores(void) { sysctl(m, 2, &count, &len, NULL, 0); return count; + +#elif defined(AIX) + //returns the number of processors which are currently online + return sysconf(_SC_NPROCESSORS_ONLN); + #else return 2; #endif diff --git a/kernel/Makefile.L3 b/kernel/Makefile.L3 index 86772cb22..dfdaf5cf4 100644 --- a/kernel/Makefile.L3 +++ b/kernel/Makefile.L3 @@ -514,7 +514,7 @@ $(KDIR)$(SGEMMONCOPYOBJ) : $(KERNELDIR)/$(SGEMMONCOPY) $(KDIR)$(SGEMMOTCOPYOBJ) : $(KERNELDIR)/$(SGEMMOTCOPY) ifeq ($(OS), AIX) - $(CC) $(CFLAGS) -S -UDOUBLE -UCOMPLEX $< -o - > sgemmotcopy.s + $(CC) $(CFLAGS) -S -UDOUBLE -UCOMPLEX $< -o - > sgemmotcopy.s m4 sgemmotcopy.s > sgemmotcopy_nomacros.s $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX sgemmotcopy_nomacros.s -o $@ rm sgemmotcopy.s sgemmotcopy_nomacros.s @@ -530,7 +530,7 @@ $(KDIR)$(SGEMMINCOPYOBJ) : $(KERNELDIR)/$(SGEMMINCOPY) $(KDIR)$(SGEMMITCOPYOBJ) : $(KERNELDIR)/$(SGEMMITCOPY) ifeq ($(OS), AIX) - $(CC) $(CFLAGS) -S -UDOUBLE -UCOMPLEX $< -o - > sgemmitcopy.s + $(CC) $(CFLAGS) -S -UDOUBLE -UCOMPLEX $< -o - > sgemmitcopy.s m4 sgemmitcopy.s > sgemmitcopy_nomacros.s $(CC) $(CFLAGS) -c -UDOUBLE -UCOMPLEX sgemmitcopy_nomacros.s -o $@ rm sgemmitcopy.s sgemmitcopy_nomacros.s diff --git a/utest/Makefile b/utest/Makefile index 0b9892411..31d4ccf00 100644 --- a/utest/Makefile +++ b/utest/Makefile @@ -34,6 +34,9 @@ endif ifeq ($(C_COMPILER), PGI) OBJS = utest_main2.o endif +ifeq ($(OSNAME), AIX) +OBJS = utest_main2.o +endif all : run_test