[Genabel-commits] r1052 - in pkg/OmicABEL: . inc src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Dec 13 12:24:07 CET 2012
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 )
More information about the Genabel-commits
mailing list