diff --git a/Changelog.txt b/Changelog.txt index 7d8a06edb..48c5a727d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,21 @@ OpenBLAS ChangeLog +==================================================================== +Version 0.1 alpha2.4 +18-Sep-2011 +common: + * Fixed a bug about installation. The header file "fblas77.h" + works fine now. + * Fixed #61 a building bug about setting TARGET and DYNAMIC_ARCH. + * Try to handle absolute path of shared library in OSX. (#57) + Thank Dr Kane O'Donnell. + * Changed the installation folder layout to $(PREFIX)/include and + $(PREFIX)/lib + +x86/x86_64: + * Fixed #58 zdot/xdot SEGFAULT bug with GCC-4.6 on x86. According + to i386 calling convention, The callee should remove the first + hidden parameter.Thank Mr. John for this patch. + ==================================================================== Version 0.1 alpha2.3 5-Sep-2011 diff --git a/Makefile b/Makefile index 6789272a3..56d491077 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,20 @@ ifndef SMP else @echo " (Multi threaded; Max num-threads is $(NUM_THREADS))" endif + +ifeq ($(OSNAME), Darwin) + @echo "WARNING: If you plan to use the dynamic library $(LIBDYNNAME), you must run:" + @echo + @echo "\"make PREFIX=/your_installation_path/ install\"." + @echo + @echo "(or set PREFIX in Makefile.rule and run make install." + @echo "If you want to move the .dylib to a new location later, make sure you change" + @echo "the internal name of the dylib with:" + @echo + @echo "install_name_tool -id /new/absolute/path/to/$(LIBDYNNAME) $(LIBDYNNAME)" +endif + @echo + @echo "To install the library, you can run \"make PREFIX=/path/to/your/installation install\"." @echo shared : @@ -118,6 +132,13 @@ endif #Save the config files for installation cp Makefile.conf Makefile.conf_last cp config.h config_last.h +ifdef QUAD_PRECISION + echo "#define QUAD_PRECISION">> config_last.h +endif +ifeq ($(EXPRECISION), 1) + echo "#define EXPRECISION">> config_last.h +endif +## ifdef DYNAMIC_ARCH $(MAKE) -C kernel commonlibs || exit 1 for d in $(DYNAMIC_CORE) ; \ diff --git a/Makefile.install b/Makefile.install index 80dafc9c6..2778a491f 100644 --- a/Makefile.install +++ b/Makefile.install @@ -3,6 +3,9 @@ export GOTOBLAS_MAKEFILE = 1 -include $(TOPDIR)/Makefile.conf_last include ./Makefile.system +OPENBLAS_INCLUDE_DIR:=$(PREFIX)/include +OPENBLAS_LIBRARY_DIR:=$(PREFIX)/lib + .PHONY : install .NOTPARALLEL : install @@ -11,54 +14,57 @@ lib.grd : install : lib.grd @-mkdir -p $(PREFIX) - @echo Generating openblas_config.h in $(PREFIX) + @-mkdir -p $(OPENBLAS_INCLUDE_DIR) + @-mkdir -p $(OPENBLAS_LIBRARY_DIR) + @echo Generating openblas_config.h in $(OPENBLAS_INCLUDE_DIR) #for inc - @echo \#ifndef OPENBLAS_CONFIG_H > $(PREFIX)/openblas_config.h - @echo \#define OPENBLAS_CONFIG_H >> $(PREFIX)/openblas_config.h - @cat config_last.h >> $(PREFIX)/openblas_config.h - @echo \#define VERSION \" OpenBLAS $(VERSION) \" >> $(PREFIX)/openblas_config.h - @cat openblas_config_template.h >> $(PREFIX)/openblas_config.h - @echo \#endif >> $(PREFIX)/openblas_config.h + @echo \#ifndef OPENBLAS_CONFIG_H > $(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @echo \#define OPENBLAS_CONFIG_H >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @cat config_last.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @echo \#define VERSION \" OpenBLAS $(VERSION) \" >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @cat openblas_config_template.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h + @echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h - @echo Generating f77blas.h in $(PREFIX) - @echo \#ifndef OPENBLAS_F77BLAS_H > $(PREFIX)/f77blas.h - @echo \#define OPENBLAS_F77BLAS_H >> $(PREFIX)/f77blas.h - @echo \#include \"openblas_config.h\" >> $(PREFIX)/f77blas.h - @cat common_interface.h >> $(PREFIX)/f77blas.h - @echo \#endif >> $(PREFIX)/f77blas.h + @echo Generating f77blas.h in $(OPENBLAS_INCLUDE_DIR) + @echo \#ifndef OPENBLAS_F77BLAS_H > $(OPENBLAS_INCLUDE_DIR)/f77blas.h + @echo \#define OPENBLAS_F77BLAS_H >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h + @echo \#include \"openblas_config.h\" >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h + @cat common_interface.h >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h + @echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h - @echo Generating cblas.h in $(PREFIX) - @sed 's/common/openblas_config/g' cblas.h > $(PREFIX)/cblas.h + @echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR) + @sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h #for install static library - @echo Copy the static library to $(PREFIX) - @cp $(LIBNAME) $(PREFIX) - @-ln -fs $(PREFIX)/$(LIBNAME) $(PREFIX)/libopenblas.$(LIBSUFFIX) + @echo Copy the static library to $(OPENBLAS_LIBRARY_DIR) + @cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR) + @-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBNAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.$(LIBSUFFIX) #for install shared library - @echo Copy the shared library to $(PREFIX) + @echo Copy the shared library to $(OPENBLAS_LIBRARY_DIR) ifeq ($(OSNAME), Linux) - -cp $(LIBSONAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBSONAME) $(PREFIX)/libopenblas.so + -cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.so endif ifeq ($(OSNAME), FreeBSD) - -cp $(LIBSONAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBSONAME) $(PREFIX)/libopenblas.so + -cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.so endif ifeq ($(OSNAME), NetBSD) - -cp $(LIBSONAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBSONAME) $(PREFIX)/libopenblas.so + -cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.so endif -ifeq ($(OSNAME), Darwin) - -cp $(LIBDYNNAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBDYNNAME) $(PREFIX)/libopenblas.dylib +ifeq ($(OSNAME), Darwin) + -cp $(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR) + -install_name_tool -id $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.dylib endif ifeq ($(OSNAME), WINNT) - -cp $(LIBDLLNAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBDLLNAME) $(PREFIX)/libopenblas.dll + -cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.dll endif ifeq ($(OSNAME), CYGWIN_NT) - -cp $(LIBDLLNAME) $(PREFIX) - -ln -fs $(PREFIX)/$(LIBDLLNAME) $(PREFIX)/libopenblas.dll + -cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR) + -ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/libopenblas.dll endif @echo Install OK! diff --git a/Makefile.rule b/Makefile.rule index 3b32ded84..a7ba203fc 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -3,7 +3,7 @@ # # This library's version -VERSION = 0.1alpha2.3 +VERSION = 0.1alpha2.4 # You can specify the target architecture, otherwise it's # automatically detected. diff --git a/Makefile.system b/Makefile.system index f0487ac50..84f41a78f 100644 --- a/Makefile.system +++ b/Makefile.system @@ -27,7 +27,13 @@ HOSTCC = $(CC) endif ifdef TARGET -GETARCH_FLAGS += -DFORCE_$(TARGET) +GETARCH_FLAGS := -DFORCE_$(TARGET) +endif + +#TARGET_CORE will override TARGET which is used in DYNAMIC_ARCH=1. +# +ifdef TARGET_CORE +GETARCH_FLAGS := -DFORCE_$(TARGET_CORE) endif ifdef INTERFACE64 diff --git a/common_interface.h b/common_interface.h index 36bf5aa48..898d91001 100644 --- a/common_interface.h +++ b/common_interface.h @@ -38,6 +38,11 @@ #ifndef ASSEMBLER +#ifdef __cplusplus +extern "C" { + /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + int BLASFUNC(xerbla)(char *, blasint *info, blasint); FLOATRET BLASFUNC(sdot) (blasint *, float *, blasint *, float *, blasint *); @@ -733,4 +738,10 @@ xdouble BLASFUNC(qlamch)(char *); FLOATRET BLASFUNC(slamc3)(float *, float *); double BLASFUNC(dlamc3)(double *, double *); xdouble BLASFUNC(qlamc3)(xdouble *, xdouble *); + +#ifdef __cplusplus +} + +#endif /* __cplusplus */ + #endif diff --git a/exports/Makefile b/exports/Makefile index f4c9314f9..08f496501 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -85,7 +85,7 @@ libgoto_hpl.def : gensymbol perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F) $(LIBDYNNAME) : ../$(LIBNAME) osx.def - $(PREFIX)gcc $(CFLAGS) -all_load -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) + $(CC) $(CFLAGS) -all_load -headerpad_max_install_names -install_name $(CURDIR)/../$(LIBDYNNAME) -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) symbol.$(SUFFIX) : symbol.S $(CC) $(CFLAGS) -c -o $(@F) $^ diff --git a/kernel/x86/xdot.S b/kernel/x86/xdot.S index 4a5af4642..929763271 100644 --- a/kernel/x86/xdot.S +++ b/kernel/x86/xdot.S @@ -307,7 +307,11 @@ popl %ebx popl %esi popl %edi +#if defined(F_INTERFACE) && defined(RETURN_BY_STACK) + ret $0x4 +#else ret +#endif ALIGN_3 .L88: @@ -326,6 +330,10 @@ popl %ebx popl %esi popl %edi - ret +#if defined(F_INTERFACE) && defined(RETURN_BY_STACK) + ret $0x4 +#else + ret +#endif EPILOGUE diff --git a/kernel/x86/zdot.S b/kernel/x86/zdot.S index aa4481f97..9d8866ad0 100644 --- a/kernel/x86/zdot.S +++ b/kernel/x86/zdot.S @@ -283,7 +283,11 @@ popl %ebx popl %esi popl %edi +#if defined(DOUBLE) || defined(XDOUBLE) + ret $0x4 +#else ret +#endif ALIGN_3 .L88: @@ -305,6 +309,10 @@ popl %ebx popl %esi popl %edi - ret +#if defined(DOUBLE) || defined(XDOUBLE) + ret $0x4 +#else + ret +#endif EPILOGUE diff --git a/kernel/x86/zdot_sse2.S b/kernel/x86/zdot_sse2.S index 2a174fb5d..efebe637b 100644 --- a/kernel/x86/zdot_sse2.S +++ b/kernel/x86/zdot_sse2.S @@ -1542,7 +1542,5 @@ popl %esi popl %edi /*remove the hidden return value address from the stack.*/ - popl %ecx - xchgl %ecx, 0(%esp) - ret + ret $0x4 EPILOGUE diff --git a/openblas_config_template.h b/openblas_config_template.h index 9fb80aa4f..8bf972593 100644 --- a/openblas_config_template.h +++ b/openblas_config_template.h @@ -6,6 +6,16 @@ #define BLASFUNC(FUNC) FUNC #endif +#ifdef QUAD_PRECISION +typedef struct { + unsigned long x[2]; +} xdouble; +#elif defined EXPRECISION +#define xdouble long double +#else +#define xdouble double +#endif + #if defined(OS_WINDOWS) && defined(__64BIT__) typedef long long BLASLONG; typedef unsigned long long BLASULONG; @@ -19,3 +29,13 @@ typedef BLASLONG blasint; #else typedef int blasint; #endif + +#if defined(XDOUBLE) || defined(DOUBLE) +#define FLOATRET FLOAT +#else +#ifdef NEED_F2CCONV +#define FLOATRET double +#else +#define FLOATRET float +#endif +#endif