From 307d0459f6f22ff07e9d0b8d4090a27ba91cddd0 Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Mon, 30 Apr 2018 09:47:48 +0100 Subject: OS paths independency for Mex, GPU funcs corrrected --- Wrappers/Matlab/mex_compile/compileCPU_mex.m | 30 +++++++++++++++++----------- Wrappers/Matlab/mex_compile/compileGPU_mex.m | 30 ++++++++++++++++------------ 2 files changed, 35 insertions(+), 25 deletions(-) (limited to 'Wrappers') diff --git a/Wrappers/Matlab/mex_compile/compileCPU_mex.m b/Wrappers/Matlab/mex_compile/compileCPU_mex.m index a445e99..ee0d99e 100644 --- a/Wrappers/Matlab/mex_compile/compileCPU_mex.m +++ b/Wrappers/Matlab/mex_compile/compileCPU_mex.m @@ -1,34 +1,40 @@ % execute this mex file in Matlab once -copyfile ../../../Core/regularisers_CPU/ regularisers_CPU/ -copyfile ../../../Core/CCPiDefines.h regularisers_CPU/ -cd regularisers_CPU/ +pathcopyFrom = sprintf(['..' filesep '..' filesep '..' filesep 'Core' filesep 'regularisers_CPU'], 1i); +pathcopyFrom1 = sprintf(['..' filesep '..' filesep '..' filesep 'Core' filesep 'CCPiDefines.h'], 1i); + +copyfile(pathcopyFrom, 'regularisers_CPU'); +copyfile(pathcopyFrom1, 'regularisers_CPU'); + +cd regularisers_CPU + +Pathmove = sprintf(['..' filesep 'installed' filesep], 1i); fprintf('%s \n', 'Compiling CPU regularisers...'); mex ROF_TV.c ROF_TV_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile ROF_TV.mex* ../installed/ +movefile('ROF_TV.mex*',Pathmove); mex FGP_TV.c FGP_TV_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile FGP_TV.mex* ../installed/ +movefile('FGP_TV.mex*',Pathmove); mex SB_TV.c SB_TV_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile SB_TV.mex* ../installed/ +movefile('SB_TV.mex*',Pathmove); mex FGP_dTV.c FGP_dTV_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile FGP_dTV.mex* ../installed/ +movefile('FGP_dTV.mex*',Pathmove); mex TNV.c TNV_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile TNV.mex* ../installed/ +movefile('TNV.mex*',Pathmove); mex NonlDiff.c Diffusion_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile NonlDiff.mex* ../installed/ +movefile('NonlDiff.mex*',Pathmove); mex TV_energy.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp" -movefile TV_energy.mex* ../installed/ +movefile('TV_energy.mex*',Pathmove); delete SB_TV_core* ROF_TV_core* FGP_TV_core* FGP_dTV_core* TNV_core* utils* Diffusion_core* CCPiDefines.h - fprintf('%s \n', 'All successfully compiled!'); -cd ../../ +pathA = sprintf(['..' filesep '..' filesep], 1i); +cd(pathA); cd demos diff --git a/Wrappers/Matlab/mex_compile/compileGPU_mex.m b/Wrappers/Matlab/mex_compile/compileGPU_mex.m index 55b51eb..46d85a6 100644 --- a/Wrappers/Matlab/mex_compile/compileGPU_mex.m +++ b/Wrappers/Matlab/mex_compile/compileGPU_mex.m @@ -7,36 +7,40 @@ % In the code bellow we provide a full explicit path to nvcc compiler % ! paths to matlab and CUDA sdk can be different, modify accordingly ! -% tested on Ubuntu 16.04/MATLAB 2016b/cuda7.5/gcc4.9 +% Tested on Ubuntu 16.04/MATLAB 2016b/cuda7.5/gcc4.9 +% It hasn't been tested on Windows, please contact me if you'll be able to +% install it on Windows and I include it into the release. -copyfile ../../../Core/regularisers_GPU/ regularisers_GPU/ -copyfile ../../../Core/CCPiDefines.h regularisers_GPU/ +pathcopyFrom = sprintf(['..' filesep '..' filesep '..' filesep 'Core' filesep 'regularisers_GPU'], 1i); +pathcopyFrom1 = sprintf(['..' filesep '..' filesep '..' filesep 'Core' filesep 'CCPiDefines.h'], 1i); -cd regularisers_GPU/ +copyfile(pathcopyFrom, 'regularisers_GPU'); +copyfile(pathcopyFrom1, 'regularisers_GPU'); + +cd regularisers_GPU + +Pathmove = sprintf(['..' filesep 'installed' filesep], 1i); fprintf('%s \n', 'Compiling GPU regularisers (CUDA)...'); !/usr/local/cuda/bin/nvcc -O0 -c TV_ROF_GPU_core.cu -Xcompiler -fPIC -I~/SOFT/MATLAB9/extern/include/ mex -g -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib64 -lcudart -lcufft -lmwgpu ROF_TV_GPU.cpp TV_ROF_GPU_core.o -movefile ROF_TV_GPU.mex* ../installed/ +movefile('ROF_TV_GPU.mex*',Pathmove); !/usr/local/cuda/bin/nvcc -O0 -c TV_FGP_GPU_core.cu -Xcompiler -fPIC -I~/SOFT/MATLAB9/extern/include/ mex -g -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib64 -lcudart -lcufft -lmwgpu FGP_TV_GPU.cpp TV_FGP_GPU_core.o -movefile FGP_TV_GPU.mex* ../installed/ +movefile('FGP_TV_GPU.mex*',Pathmove); !/usr/local/cuda/bin/nvcc -O0 -c TV_SB_GPU_core.cu -Xcompiler -fPIC -I~/SOFT/MATLAB9/extern/include/ mex -g -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib64 -lcudart -lcufft -lmwgpu SB_TV_GPU.cpp TV_SB_GPU_core.o -movefile SB_TV_GPU.mex* ../installed/ +movefile('SB_TV_GPU.mex*',Pathmove); !/usr/local/cuda/bin/nvcc -O0 -c dTV_FGP_GPU_core.cu -Xcompiler -fPIC -I~/SOFT/MATLAB9/extern/include/ mex -g -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib64 -lcudart -lcufft -lmwgpu FGP_dTV_GPU.cpp dTV_FGP_GPU_core.o -movefile FGP_dTV_GPU.mex* ../installed/ +movefile('FGP_dTV_GPU.mex*',Pathmove); !/usr/local/cuda/bin/nvcc -O0 -c NonlDiff_GPU_core.cu -Xcompiler -fPIC -I~/SOFT/MATLAB9/extern/include/ mex -g -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib64 -lcudart -lcufft -lmwgpu NonlDiff_GPU.cpp NonlDiff_GPU_core.o -movefile NonlDiff_GPU.mex* ../installed/ +movefile('NonlDiff_GPU.mex*',Pathmove); delete TV_ROF_GPU_core* TV_FGP_GPU_core* TV_SB_GPU_core* dTV_FGP_GPU_core* NonlDiff_GPU_core* CCPiDefines.h -fprintf('%s \n', 'All successfully compiled!'); - -cd ../../ -cd demos +fprintf('%s \n', 'All successfully compiled!'); \ No newline at end of file -- cgit v1.2.3