From d6724911226b2ce528c37f6678be55ff572fd229 Mon Sep 17 00:00:00 2001 From: Xianyi Zhang Date: Sun, 20 Mar 2011 23:30:09 +0800 Subject: [PATCH 1/4] Init Changelog file for next release version(v0.1alpha2). --- Changelog.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 71677f0ee..ab8fb19c2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,14 @@ OpenBLAS ChangeLog ==================================================================== +Version 0.1 alpha2(in development) + +common: + * +x86/x86_64: + * +MIPS64: + * +==================================================================== Version 0.1 alpha1 20-Mar-2011 From 0edcdd470e5b955ef491dfc30df2a6db542d9e9a Mon Sep 17 00:00:00 2001 From: Xianyi Zhang Date: Sun, 20 Mar 2011 23:35:31 +0800 Subject: [PATCH 2/4] Updated the developing version to v0.1 alpha2. --- Makefile.rule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.rule b/Makefile.rule index d622390f4..61f9eb91d 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -3,7 +3,7 @@ # # This library's version -VERSION = 0.1alpha1 +VERSION = 0.1alpha2 # You can specify the target architecture, otherwise it's # automatically detected. From 5e7f29b19e06323f7a0fc4b8a0ac98c60055b4f2 Mon Sep 17 00:00:00 2001 From: Xianyi Zhang Date: Fri, 25 Mar 2011 01:16:12 +0800 Subject: [PATCH 3/4] Fixed #13. Fixed blasint undefined bug in file. --- Changelog.txt | 3 ++- Makefile.system | 7 ++++++- cblas.h | 3 +++ getarch_2nd.c | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index ab8fb19c2..f4f9c6e35 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3,7 +3,8 @@ OpenBLAS ChangeLog Version 0.1 alpha2(in development) common: - * + * Fixed blasint undefined bug in file. Other software + could include this header successfully(Refs issue #13 on github) x86/x86_64: * MIPS64: diff --git a/Makefile.system b/Makefile.system index 5a129732f..6fb0ec86f 100644 --- a/Makefile.system +++ b/Makefile.system @@ -30,6 +30,10 @@ ifdef TARGET GETARCH_FLAGS += -DFORCE_$(TARGET) endif +ifdef INTERFACE64 +GETARCH_FLAGS += -DUSE64BITINT +endif + # This operation is expensive, so execution should be once. ifndef GOTOBLAS_MAKEFILE export GOTOBLAS_MAKEFILE = 1 @@ -489,7 +493,8 @@ endif ifdef BINARY64 ifdef INTERFACE64 -CCOMMON_OPT += -DUSE64BITINT +CCOMMON_OPT += +#-DUSE64BITINT endif endif diff --git a/cblas.h b/cblas.h index ea0fbb629..4beae7ad5 100644 --- a/cblas.h +++ b/cblas.h @@ -1,6 +1,9 @@ #ifndef CBLAS_H #define CBLAS_H +#include +#include "common.h" + #define CBLAS_INDEX size_t enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; diff --git a/getarch_2nd.c b/getarch_2nd.c index 31babd28a..018f08d31 100644 --- a/getarch_2nd.c +++ b/getarch_2nd.c @@ -30,6 +30,10 @@ int main(int argc, char **argv) { printf("#define DLOCAL_BUFFER_SIZE\t%ld\n", (DGEMM_DEFAULT_Q * DGEMM_DEFAULT_UNROLL_N * 2 * 1 * sizeof(double))); printf("#define CLOCAL_BUFFER_SIZE\t%ld\n", (CGEMM_DEFAULT_Q * CGEMM_DEFAULT_UNROLL_N * 4 * 2 * sizeof(float))); printf("#define ZLOCAL_BUFFER_SIZE\t%ld\n", (ZGEMM_DEFAULT_Q * ZGEMM_DEFAULT_UNROLL_N * 2 * 2 * sizeof(double))); + +#ifdef USE64BITINT + printf("#define USE64BITINT\n"); +#endif } return 0; From 85f99d476942847b9414c72e69d14c6d97c4d2d3 Mon Sep 17 00:00:00 2001 From: Xianyi Zhang Date: Mon, 28 Mar 2011 10:58:39 +0800 Subject: [PATCH 4/4] Fixed #14 the SEGFAULT bug on 64 cores. On SMP server, the number of CPUs or cores should be less than or equal to 64. --- Changelog.txt | 3 +++ README | 6 +++++- driver/others/init.c | 39 ++++++++++++++++++++++++++++++++------- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index f4f9c6e35..2bffec93c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -5,6 +5,9 @@ Version 0.1 alpha2(in development) common: * Fixed blasint undefined bug in file. Other software could include this header successfully(Refs issue #13 on github) + * Fixed the SEGFAULT bug on 64 cores. On SMP server, the number + of CPUs or cores should be less than or equal to 64.(Refs issue #14 + on github) x86/x86_64: * MIPS64: diff --git a/README b/README index 9b04f6f99..4697ad44f 100644 --- a/README +++ b/README @@ -56,4 +56,8 @@ Optimization on ICT Loongson 3A CPU OpenBLAS users mailing list: http://list.rdcps.ac.cn/mailman/listinfo/openblas 8.ChangeLog -Please see Changelog.txt to obtain the differences between GotoBLAS2 1.13 BSD version. \ No newline at end of file +Please see Changelog.txt to obtain the differences between GotoBLAS2 1.13 BSD version. + +9.Known Issues +* The number of CPUs/Cores should less than or equal to 8*sizeof(unsigned long). On 64 bits, the limit + is 64. On 32 bits, it is 32. diff --git a/driver/others/init.c b/driver/others/init.c index 7ee7dc45d..4adba661f 100644 --- a/driver/others/init.c +++ b/driver/others/init.c @@ -172,13 +172,20 @@ static inline int rcount(unsigned long number) { return count; } +/*** + Known issue: The number of CPUs/cores should less + than sizeof(unsigned long). On 64 bits, the limit + is 64. On 32 bits, it is 32. +***/ static inline unsigned long get_cpumap(int node) { int infile; unsigned long affinity; char name[160]; + char cpumap[160]; char *p, *dummy; - + int i=0; + sprintf(name, CPUMAP_NAME, node); infile = open(name, O_RDONLY); @@ -187,13 +194,19 @@ static inline unsigned long get_cpumap(int node) { if (infile != -1) { - read(infile, name, sizeof(name)); - + read(infile, cpumap, sizeof(cpumap)); + p = cpumap; + while (*p != '\n' && i<160){ + if(*p != ',') { + name[i++]=*p; + } + p++; + } p = name; - while ((*p == '0') || (*p == ',')) p++; + // while ((*p == '0') || (*p == ',')) p++; - affinity = strtol(p, &dummy, 16); + affinity = strtoul(p, &dummy, 16); close(infile); } @@ -347,7 +360,13 @@ static void disable_hyperthread(void) { unsigned long share; int cpu; - common -> avail = (1UL << common -> num_procs) - 1; + if(common->num_procs > 64){ + fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(64). Terminated.\n", common->num_procs); + exit(1); + }else if(common->num_procs == 64){ + common -> avail = 0xFFFFFFFFFFFFFFFFUL; + }else + common -> avail = (1UL << common -> num_procs) - 1; #ifdef DEBUG fprintf(stderr, "\nAvail CPUs : %04lx.\n", common -> avail); @@ -376,7 +395,13 @@ static void disable_affinity(void) { fprintf(stderr, "CPU mask : %04lx.\n\n", *(unsigned long *)&cpu_orig_mask[0]); #endif - lprocmask = (1UL << common -> final_num_procs) - 1; + if(common->final_num_procs > 64){ + fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(64). Terminated.\n", common->final_num_procs); + exit(1); + }else if(common->final_num_procs == 64){ + lprocmask = 0xFFFFFFFFFFFFFFFFUL; + }else + lprocmask = (1UL << common -> final_num_procs) - 1; #ifndef USE_OPENMP lprocmask &= *(unsigned long *)&cpu_orig_mask[0];