[GenABEL-dev] [Genabel-commits] r1052
L.C. Karssen
l.karssen at erasmusmc.nl
Thu Dec 13 18:30:06 CET 2012
Dear Diego,
I was wondering whether you have tried using Autoconf and Automake for
OmicABEL. It looks like you try to support several platforms and depend
on various libraries. Autoconf can help with those. We converted
ProbABEL about a year ago and have been reaping the benefits ever since,
e.g. warnings when a library or header files are not installed by the
user, compiling on 32 and 64 bit Linux (with and without large file
support), cross-compilation on Windows, and even out-of-the box
compilation on ARM (a Raspberry Pi with Raspbian Linux), etc.
Best regards,
Lennart.
On 13-12-12 18:10, genabel-commits-request at lists.r-forge.r-project.org
wrote:
> Message: 3
> Date: Thu, 13 Dec 2012 12:24:07 +0100 (CET)
> From: noreply at r-forge.r-project.org
> To: genabel-commits at lists.r-forge.r-project.org
> Subject: [Genabel-commits] r1052 - in pkg/OmicABEL: . inc src
> Message-ID: <20121213112407.E73BA1842C1 at r-forge.r-project.org>
> Content-Type: text/plain; charset=UTF-8
>
> Author: dfabregat
> Date: 2012-12-13 12:24:07 +0100 (Thu, 13 Dec 2012)
> New Revision: 1052
>
> Modified:
> pkg/OmicABEL/Makefile
> pkg/OmicABEL/inc/make.inc.gnu-goto
> pkg/OmicABEL/inc/make.inc.gnu-mkl
> pkg/OmicABEL/inc/make.inc.icc-mkl
> pkg/OmicABEL/inc/make.inc.mac
> pkg/OmicABEL/inc/make.inc.static
> pkg/OmicABEL/make.inc
> pkg/OmicABEL/src/utils.c
> Log:
> [BUG FIX] Now the queries for total main memory and available main memory should work in both Linux and Mac.
> * Also, edited the makefiles to define the symbols LINUX and OSX accordingly.
> * -lrt moved to make.inc because not needed in Mac.
>
>
> Modified: pkg/OmicABEL/Makefile
> ===================================================================
> --- pkg/OmicABEL/Makefile 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/Makefile 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -4,7 +4,7 @@
> DRIVER = ./HP-GWAS
>
> CFLAGS+=-g -Wall -I $(SRCDIR)/ # -D__WORDSIZE=64
> -LDLIBS += -lm -lrt
> +LDLIBS += -lm
>
> SRCS = $(SRCDIR)/CLAK_GWAS.c $(SRCDIR)/fgls_chol.c $(SRCDIR)/fgls_eigen.c $(SRCDIR)/wrappers.c $(SRCDIR)/timing.c $(SRCDIR)/statistics.c $(SRCDIR)/REML.c $(SRCDIR)/optimization.c $(SRCDIR)/ooc_BLAS.c $(SRCDIR)/double_buffering.c $(SRCDIR)/utils.c $(SRCDIR)/GWAS.c $(SRCDIR)/databel.c
> OBJS = $(SRCS:.c=.o)
>
> Modified: pkg/OmicABEL/inc/make.inc.gnu-goto
> ===================================================================
> --- pkg/OmicABEL/inc/make.inc.gnu-goto 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/inc/make.inc.gnu-goto 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,5 +1,5 @@
> CC = gcc
> -CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DGOTO
> +CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DGOTO -DLINUX
>
> LDFLAGS =
> -LDLIBS = $(HOME)/lapack/lapack_LINUX.a $(HOME)/GotoBLAS2/libgoto2.a -lgfortran -gfortranbegin -lpthread
> +LDLIBS = $(HOME)/lapack/lapack_LINUX.a $(HOME)/GotoBLAS2/libgoto2.a -lgfortran -gfortranbegin -lpthread -lrt
>
> Modified: pkg/OmicABEL/inc/make.inc.gnu-mkl
> ===================================================================
> --- pkg/OmicABEL/inc/make.inc.gnu-mkl 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/inc/make.inc.gnu-mkl 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,5 +1,5 @@
> CC = gcc
> -CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DMKL
> +CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DMKL -DLINUX
>
> LDFLAGS = -L$(MKLROOT)/lib/intel64/ -L$(MKLROOT)/lib/em64t/ -L$(INTELROOT)/compiler/lib/intel64
> -LDLIBS = -lrwthmkl -liomp5
> +LDLIBS = -lrwthmkl -liomp5 -lrt
>
> Modified: pkg/OmicABEL/inc/make.inc.icc-mkl
> ===================================================================
> --- pkg/OmicABEL/inc/make.inc.icc-mkl 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/inc/make.inc.icc-mkl 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,5 +1,5 @@
> CC = icc
> -CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -openmp -DMKL
> +CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -openmp -DMKL -DLINUX
>
> LDFLAGS = -L$(MKLROOT)/lib/intel64/ -L$(INTELROOT)/compiler/lib/intel64
> -LDLIBS = -lrwthmkl
> +LDLIBS = -lrwthmkl -lrt
>
> Modified: pkg/OmicABEL/inc/make.inc.mac
> ===================================================================
> --- pkg/OmicABEL/inc/make.inc.mac 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/inc/make.inc.mac 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,5 +1,5 @@
> CC = icc
> -CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -openmp -DMKL
> +CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -openmp -DMKL -DOSX
>
> LDFLAGS = -L$(MKLROOT)/lib/ -L/opt/intel/composerxe-2011.1.122/compiler/lib/
> -LDLIBS = -lmkl_intel -lmkl_intel_thread -lmkl_core -liomp5 -lmkl_lapack95_ilp64 # -lguide
> +LDLIBS = -lmkl_intel -lmkl_intel_thread -lmkl_core -liomp5 -lmkl_lapack95_ilp64
>
> Modified: pkg/OmicABEL/inc/make.inc.static
> ===================================================================
> --- pkg/OmicABEL/inc/make.inc.static 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/inc/make.inc.static 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,5 +1,5 @@
> CC = gcc
> -CFLAGS = -static -static-libgcc -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DMKL
> +CFLAGS = -static -static-libgcc -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DMKL -DLINUX
>
> #LDFLAGS = -L$(MKLROOT)/lib/intel64/ -L$(MKLROOT)/lib/em64t/ -L$(INTELROOT)/compiler/lib/intel64
> -LDLIBS = $(MKLROOT)/lib/intel64/librwthmkl.a $(INTELROOT)/compiler/lib/intel64/libiomp5.a
> +LDLIBS = $(MKLROOT)/lib/intel64/librwthmkl.a $(INTELROOT)/compiler/lib/intel64/libiomp5.a -lrt
>
> Modified: pkg/OmicABEL/make.inc
> ===================================================================
> --- pkg/OmicABEL/make.inc 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/make.inc 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -1,4 +1,5 @@
> CC = gcc
> -CFLAGS = -static -static-libgcc -D_FILE_OFFSET_BITS=64 -fopenmp -DMKL
> +CFLAGS = -D_FILE_OFFSET_BITS=64 -pthread -fopenmp -DGOTO -DLINUX
>
> -LDLIBS = $(MKLROOT)/lib/intel64/librwthmkl.a $(INTELROOT)/compiler/lib/intel64/libiomp5.a
> +LDFLAGS =
> +LDLIBS = $(HOME)/lapack/lapack_LINUX.a $(HOME)/GotoBLAS2/libgoto2.a -lgfortran -gfortranbegin -lpthread -lrt
>
> Modified: pkg/OmicABEL/src/utils.c
> ===================================================================
> --- pkg/OmicABEL/src/utils.c 2012-12-13 11:13:33 UTC (rev 1051)
> +++ pkg/OmicABEL/src/utils.c 2012-12-13 11:24:07 UTC (rev 1052)
> @@ -30,6 +30,10 @@
>
> #include <sys/time.h>
>
> +#if defined OSX
> + #include <sys/sysctl.h>
> +#endif
> +
> #include <omp.h>
> #if defined MKL
> #include <mkl.h>
> @@ -48,10 +52,8 @@
> setenv("GOTO_NUM_THREADS", nths_str, 1);
> setenv("OMP_NUM_THREADS", "1", 1);
> #elif defined MKL
> - /*setenv("MKL_NUM_THREADS", nths_str, 1);*/
> - mkl_set_num_threads(nths);
> - /*setenv("OMP_NUM_THREADS", "1", 1);*/
> - omp_set_num_threads(nths); // CHECK - Should this be 1?
> + mkl_set_num_threads(nths); // Set MKL to use nths for multithreaded BLAS
> + omp_set_num_threads(nths); // Set OMP to use nths for the openmp parallel directives
> #else
> setenv("OMP_NUM_THREADS", nths_str, 1);
> #endif
> @@ -61,11 +63,8 @@
> {
> #if defined GOTO
> setenv("GOTO_NUM_THREADS", "1", 1);
> - /*setenv("OMP_NUM_THREADS", "1", 1);*/
> #elif defined MKL
> - /*setenv("MKL_NUM_THREADS", "1", 1);*/
> mkl_set_num_threads(1);
> - /*setenv("OMP_NUM_THREADS", "1", 1);*/
> omp_set_num_threads(1);
> #else
> setenv("OMP_NUM_THREADS", "1", 1);
> @@ -79,6 +78,7 @@
> size_t size = 0;
> char buff[STR_BUFFER_SIZE], field[STR_BUFFER_SIZE], unit[STR_BUFFER_SIZE];
>
> +#if defined LINUX
> fp = fgls_fopen( "/proc/meminfo", "rb" );
> fgets( buff, STR_BUFFER_SIZE, fp );
> while ( found < 2 && !feof(fp) ) // Until 2 pieces of info found: Total Mem and Available Mem
> @@ -103,6 +103,25 @@
> fgets( buff, STR_BUFFER_SIZE, fp );
> }
> fclose( fp );
> +#elif defined OSX
> + int mib[2];
> + u_int namelen;
> + size_t len;
> +
> + mib[0] = CTL_HW;
> + mib[1] = HW_MEMSIZE;
> + namelen = 2;
> + len = sizeof(*totalMem);
> + sysctl(mib, namelen, totalMem, &len, NULL, 0);
> +
> + mib[0] = CTL_HW;
> + mib[1] = HW_USERMEM;
> + namelen = 2;
> + len = sizeof(*availMem);
> + sysctl(mib, namelen, availMem, &len, NULL, 0);
> +#else
> + // Something
> +#endif
> }
>
> void load_dimensions( FGLS_config_t *cf, char *dir )
>
>
>
--
-----------------------------------------------
dr. L.C. Karssen
Erasmus MC
Department of Epidemiology
Room Ee-2224
Postbus 2040
3000 CA Rotterdam
The Netherlands
phone: +31-10-7044217
fax: +31-10-7044657
e-mail: l.karssen at erasmusmc.nl
GPG key ID: 0E1D39E3
-----------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: OpenPGP digital signature
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20121213/bed1e2ff/attachment.sig>
More information about the genabel-devel
mailing list