-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- size reduction: compile multiple tools into one 'bart' binary - size reduction: do not compile with debugging by default - use -framework Accelerate instead of -f.. vecLib to fix compilation for MacOS X Yosemite - Makefile: add compile-time OMP option for OpenMP - 'bart.m' matlab script to simplify calling of tools - mat2cfl: new tool to import certain matlab data files - nlinv: add option for real-value constrained reconstruction - normalize: normalize using l1 norm - ecalib/ecaltwo: option normalize sensitivities using l1 norm - (still commented out: normalize phase according to max. variance) - add power iteration algorithm - 'normalizel1' function to normalize using l1 norm - functions to construct matrix from non-overlapping blocks - add functions 'md_zarg' / 'md_zexpj' - fix 'md_zsadd' to take a complex scalar - runtime option to turn off cuda memory caching - MD_BIT, ..., bit fiddling macros - eliminate hard dependency on GSL in gridding code - other minor changes and enhancements
- Loading branch information
Showing
89 changed files
with
1,716 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,18 @@ CUDA=0 | |
ACML=0 | ||
CULA=0 | ||
GSL=1 | ||
OMP=1 | ||
|
||
BUILDTYPE = Linux | ||
UNAME = $(shell uname -s) | ||
NNAME = $(shell uname -n) | ||
|
||
MYLINK=ln | ||
|
||
ifeq ($(UNAME),Darwin) | ||
BUILDTYPE = MacOSX | ||
ACML = 0 | ||
MYLINK = ln -s | ||
endif | ||
|
||
ARFLAGS = r | ||
|
@@ -49,13 +53,12 @@ ALLDEPS = $(shell find $(srcdir) -name ".*.d") | |
|
||
OPT = -O3 -ffast-math | ||
CPPFLAGS = $(DEPFLAG) -Wall -Wextra -I$(srcdir)/ | ||
CFLAGS = -g $(OPT) -std=c99 -Wmissing-prototypes -fopenmp -I$(srcdir)/ | ||
CXXFLAGS = -g $(OPT) -fopenmp -I$(srcdir)/ | ||
CFLAGS = $(OPT) -std=c99 -Wmissing-prototypes -I$(srcdir)/ | ||
CXXFLAGS = $(OPT) -I$(srcdir)/ | ||
CC = gcc | ||
CXX = g++ | ||
|
||
|
||
|
||
#ifeq ($(BUILDTYPE), MacOSX) | ||
# CC = gcc-mp-4.7 | ||
#endif | ||
|
@@ -85,13 +88,18 @@ acml.top := /usr/local/acml/acml4.4.0/gfortran64_mp/ | |
|
||
fftw.top := /usr/ | ||
|
||
# Matlab | ||
|
||
matlab.top := /usr/local/matlab/ | ||
|
||
# ISMRM | ||
|
||
ismrm.top := /usr/local/ismrmrd/ | ||
|
||
|
||
|
||
|
||
|
||
# Main build targets | ||
|
||
TBASE=slice crop resize join transpose zeros ones flip circshift extract repmat bitmask | ||
|
@@ -101,8 +109,9 @@ TRECO=sense pocsense rsense bpsense itsense nlinv nufft rof nusense | |
TCALIB=ecalib caldir walsh cc | ||
TMRI=rss homodyne pattern poisson twixread | ||
TSIM=phantom traj | ||
TARGETS = $(TBASE) $(TFLP) $(TNUM) $(TRECO) $(TCALIB) $(TMRI) $(TSIM) $(TIO) | ||
|
||
BTARGETS = $(TBASE) $(TFLP) $(TNUM) | ||
XTARGETS = bart $(TRECO) $(TCALIB) $(TMRI) $(TSIM) | ||
TARGETS = $(BTARGETS) $(XTARGETS) | ||
|
||
|
||
|
||
|
@@ -125,14 +134,12 @@ MODULES_nufft = -lnoncart -liter -llinops | |
MODULES_rof = -liter -llinops | ||
MODULES_bench = -lwavelet2 -lwavelet3 -llinops | ||
MODULES_phantom = -lsimu | ||
MODULES_bart += -lbox -lwavelet2 -lwavelet3 -llinops | ||
|
||
|
||
-include Makefile.$(NNAME) | ||
-include Makefile.local | ||
|
||
ifeq ($(ACML),1) | ||
TARGETS += $(TLOWRANK) | ||
endif | ||
|
||
|
||
|
||
|
@@ -162,7 +169,7 @@ ifeq ($(CUDA),1) | |
CUDA_H := -I$(cuda.top)/include | ||
CPPFLAGS += -DUSE_CUDA $(CUDA_H) | ||
ifeq ($(BUILDTYPE), MacOSX) | ||
CUDA_L := -L$(cuda.top)/lib -lcufft -lcudart -lcublas -lcuda -m64 | ||
CUDA_L := -L$(cuda.top)/lib -lcufft -lcudart -lcublas -lcuda -m64 -lstdc++ | ||
else | ||
CUDA_L := -L$(cuda.top)/lib64 -lcufft -lcudart -lcublas -lcuda -lstdc++ | ||
endif | ||
|
@@ -171,7 +178,7 @@ CUDA_H := | |
CUDA_L := | ||
endif | ||
|
||
NVCCFLAGS = -DUSE_CUDA -Xcompiler -fPIC -Xcompiler -fopenmp -O3 -arch=sm_20 -I$(srcdir)/ -m64 | ||
NVCCFLAGS = -DUSE_CUDA -Xcompiler -fPIC -Xcompiler -fopenmp -O3 -arch=sm_20 -I$(srcdir)/ -m64 -ccbin $(CC) | ||
#NVCCFLAGS = -Xcompiler -fPIC -Xcompiler -fopenmp -O3 -I$(srcdir)/ | ||
|
||
|
||
|
@@ -181,6 +188,16 @@ NVCCFLAGS = -DUSE_CUDA -Xcompiler -fPIC -Xcompiler -fopenmp -O3 -arch=sm_20 -I$( | |
|
||
|
||
|
||
ifeq ($(OMP),1) | ||
CFLAGS += -fopenmp | ||
CXXFLAGS += -fopenmp | ||
else | ||
CFLAGS += -Wno-unknown-pragmas | ||
CXXFLAGS += -Wno-unknown-pragmas | ||
endif | ||
|
||
|
||
|
||
# cula | ||
|
||
ifeq ($(CULA),1) | ||
|
@@ -217,11 +234,11 @@ BLAS_L := | |
|
||
ifeq ($(ACML),1) | ||
BLAS_H := -I$(acml.top)/include | ||
BLAS_L := $(wildcard $(acml.top)/lib/*.a) -lgfortran | ||
BLAS_L := -L$(acml.top)/lib -lgfortran -lacml_mp -Wl,-rpath $(acml.top)/lib | ||
CPPFLAGS += -DUSE_ACML | ||
else | ||
ifeq ($(BUILDTYPE), MacOSX) | ||
BLAS_L := -lblas -framework vecLib | ||
BLAS_L := -lblas -framework Accelerate | ||
else | ||
BLAS_L := -llapack -lblas | ||
endif | ||
|
@@ -238,8 +255,7 @@ FFTW_L := -L$(fftw.top)/lib -lfftw3f_threads -lfftw3f | |
# Matlab | ||
|
||
MATLAB_H := -I$(matlab.top)/extern/include | ||
MATLAB_L := -Wl,-rpath-link,$(matlab.top)/bin/glnxa64 -L$(matlab.top)/bin/glnxa64 -lmat -lmx -lm -lstdc++ | ||
|
||
MATLAB_L := -Wl,-rpath $(matlab.top)/bin/glnxa64 -L$(matlab.top)/bin/glnxa64 -lmat -lmx -lm -lstdc++ | ||
|
||
# ISMRM | ||
|
||
|
@@ -267,16 +283,26 @@ all: $(TARGETS) | |
|
||
|
||
|
||
# special ismrmrd target | ||
# special targets | ||
|
||
|
||
bart: CPPFLAGS += -DMAIN_LIST="$(BTARGETS:%=%,) ()" | ||
|
||
|
||
ismrmrd: $(srcdir)/ismrmrd.c -lismrm -lnum -lmisc | ||
$(CC) $(CXXFLAGS) -o ismrmrd $+ $(CUDA_L) $(ISMRM_L) -lstdc++ -lm | ||
|
||
mat2cfl: $(srcdir)/mat2cfl.c -lnum -lmisc | ||
$(CC) $(CFLAGS) $(MATLAB_H) -omat2cfl $+ $(MATLAB_L) $(CUDA_L) | ||
|
||
|
||
$(BTARGETS): bart | ||
rm -f $@ && $(MYLINK) bart $@ | ||
|
||
|
||
.SECONDEXPANSION: | ||
$(TARGETS): % : $(srcdir)/%.c $$(MODULES_%) $(MODULES) | ||
$(CC) $(CPPFLAGS) $(CFLAGS) -Dmain_$@=main -o $@ $+ $(FFTW_L) $(CUDA_L) $(CULA_L) $(BLAS_L) $(GSL_L) -lm -lstdc++ -lpng | ||
$(XTARGETS): % : $(srcdir)/%.c $$(MODULES_%) $(MODULES) | ||
$(CC) $(CPPFLAGS) $(CFLAGS) -Dmain_$@=main -o $@ $+ $(FFTW_L) $(CUDA_L) $(CULA_L) $(BLAS_L) $(GSL_L) -lm #-lpng | ||
# rm $(srcdir)/[email protected] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
% 2014 Martin Uecker <[email protected]> | ||
|
||
function [varargout] = bart(cmd, varargin); | ||
|
||
if isempty(getenv('TOOLBOX_PATH')) | ||
error('Environment variable TOOLBOX_PATH is not set.'); | ||
end | ||
|
||
if ismac==1 | ||
setenv('DYLD_LIBRARY_PATH', ''); | ||
else | ||
setenv('LD_LIBRARY_PATH', ''); | ||
end | ||
|
||
name = tempname; | ||
|
||
in = cell(1, nargin - 1); | ||
|
||
for i=1:nargin - 1, | ||
in{i} = strcat(name, 'in', num2str(i)); | ||
writecfl(in{i}, varargin{i}); | ||
end | ||
|
||
out = cell(1, nargout); | ||
|
||
for i=1:nargout, | ||
out{i} = strcat(name, 'out', num2str(i)); | ||
end | ||
|
||
system([getenv('TOOLBOX_PATH'), '/', cmd, ' ', strjoin(in, ' '), ' ', strjoin(out, ' ')]); | ||
|
||
for i=1:nargin - 1, | ||
delete(strcat(in{i}, '.cfl')); | ||
delete(strcat(in{i}, '.hdr')); | ||
end | ||
|
||
for i=1:nargout, | ||
varargout{i} = readcfl(out{i}); | ||
delete(strcat(out{i}, '.cfl')); | ||
delete(strcat(out{i}, '.hdr')); | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
|
||
boxsrcs := $(BTARGETS:%=src/%.c) | ||
boxobjs := $(boxsrcs:.c=.o) | ||
|
||
.INTERMEDIATE: $(boxobjs) | ||
|
||
lib/libbox.a: libbox.a($(boxobjs)) | ||
lib/libbox.a: CFLAGS += -Wno-missing-prototypes | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* Copyright 2015. The Regents of the University of California. | ||
* All rights reserved. Use of this source code is governed by | ||
* a BSD-style license which can be found in the LICENSE file. | ||
* | ||
* Authors: | ||
* 2014 Martin Uecker <[email protected]> | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <libgen.h> | ||
|
||
#include "misc/misc.h" | ||
#include "misc/cppmap.h" | ||
|
||
|
||
#define DECLMAIN(x) \ | ||
extern int main_ ## x(int argc, char* argv[]); | ||
MAP(DECLMAIN, MAIN_LIST) | ||
#undef DECLMAIN | ||
|
||
struct { | ||
|
||
int (*main_fun)(int argc, char* argv[]); | ||
const char* name; | ||
|
||
} dispatch_table[] = { | ||
|
||
#define DENTRY(x) { main_ ## x, # x }, | ||
MAP(DENTRY, MAIN_LIST) | ||
#undef DENTRY | ||
{ NULL, NULL } | ||
}; | ||
|
||
static void usage(void) | ||
{ | ||
printf("BART. Available commands are:"); | ||
|
||
for (int i = 0; NULL != dispatch_table[i].name; i++) { | ||
|
||
if (0 == i % 6) | ||
printf("\n"); | ||
|
||
printf("%-12s", dispatch_table[i].name); | ||
} | ||
|
||
printf("\n"); | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
char* bn = basename(argv[0]); | ||
|
||
if (0 == strcmp(bn, "bart")) { | ||
|
||
if (1 == argc) { | ||
|
||
usage(); | ||
exit(1); | ||
} | ||
|
||
return main(argc - 1, argv + 1); | ||
} | ||
|
||
for (int i = 0; NULL != dispatch_table[i].name; i++) { | ||
|
||
if (0 == strcmp(bn, dispatch_table[i].name)) | ||
return dispatch_table[i].main_fun(argc, argv); | ||
} | ||
|
||
fprintf(stderr, "Unknown command.\n"); | ||
exit(1); | ||
} | ||
|
||
|
Oops, something went wrong.