summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Kazantsev <dkazanc@hotmail.com>2018-04-30 09:47:48 +0100
committerDaniil Kazantsev <dkazanc@hotmail.com>2018-04-30 09:47:48 +0100
commit307d0459f6f22ff07e9d0b8d4090a27ba91cddd0 (patch)
treed2d7d00ed14e259d410f9f05328ccbdbc317ae62
parenta9d773b384c6391dbb9913deeafa3e79e108b790 (diff)
downloadregularization-307d0459f6f22ff07e9d0b8d4090a27ba91cddd0.tar.gz
regularization-307d0459f6f22ff07e9d0b8d4090a27ba91cddd0.tar.bz2
regularization-307d0459f6f22ff07e9d0b8d4090a27ba91cddd0.tar.xz
regularization-307d0459f6f22ff07e9d0b8d4090a27ba91cddd0.zip
OS paths independency for Mex, GPU funcs corrrected
-rw-r--r--Core/regularisers_GPU/NonlDiff_GPU_core.cu2
-rwxr-xr-xCore/regularisers_GPU/TV_FGP_GPU_core.cu2
-rwxr-xr-xCore/regularisers_GPU/TV_ROF_GPU_core.cu2
-rwxr-xr-xCore/regularisers_GPU/TV_SB_GPU_core.cu2
-rw-r--r--Core/regularisers_GPU/dTV_FGP_GPU_core.cu2
-rw-r--r--Wrappers/Matlab/mex_compile/compileCPU_mex.m30
-rw-r--r--Wrappers/Matlab/mex_compile/compileGPU_mex.m30
7 files changed, 40 insertions, 30 deletions
diff --git a/Core/regularisers_GPU/NonlDiff_GPU_core.cu b/Core/regularisers_GPU/NonlDiff_GPU_core.cu
index be9f5f1..8048830 100644
--- a/Core/regularisers_GPU/NonlDiff_GPU_core.cu
+++ b/Core/regularisers_GPU/NonlDiff_GPU_core.cu
@@ -350,5 +350,5 @@ extern "C" void NonlDiff_GPU_main(float *Input, float *Output, float lambdaPar,
CHECK(cudaMemcpy(Output,d_output,N*M*Z*sizeof(float),cudaMemcpyDeviceToHost));
CHECK(cudaFree(d_input));
CHECK(cudaFree(d_output));
- cudaDeviceReset();
+ //cudaDeviceReset();
}
diff --git a/Core/regularisers_GPU/TV_FGP_GPU_core.cu b/Core/regularisers_GPU/TV_FGP_GPU_core.cu
index c0ae890..eab7a44 100755
--- a/Core/regularisers_GPU/TV_FGP_GPU_core.cu
+++ b/Core/regularisers_GPU/TV_FGP_GPU_core.cu
@@ -570,5 +570,5 @@ extern "C" void TV_FGP_GPU_main(float *Input, float *Output, float lambdaPar, in
cudaFree(R2);
cudaFree(R3);
}
- cudaDeviceReset();
+ //cudaDeviceReset();
}
diff --git a/Core/regularisers_GPU/TV_ROF_GPU_core.cu b/Core/regularisers_GPU/TV_ROF_GPU_core.cu
index 1a54d02..67cdd5c 100755
--- a/Core/regularisers_GPU/TV_ROF_GPU_core.cu
+++ b/Core/regularisers_GPU/TV_ROF_GPU_core.cu
@@ -364,5 +364,5 @@ extern "C" void TV_ROF_GPU_main(float* Input, float* Output, float lambdaPar, in
CHECK(cudaFree(d_update));
CHECK(cudaFree(d_D1));
CHECK(cudaFree(d_D2));
- cudaDeviceReset();
+ //cudaDeviceReset();
}
diff --git a/Core/regularisers_GPU/TV_SB_GPU_core.cu b/Core/regularisers_GPU/TV_SB_GPU_core.cu
index b2100da..68b9221 100755
--- a/Core/regularisers_GPU/TV_SB_GPU_core.cu
+++ b/Core/regularisers_GPU/TV_SB_GPU_core.cu
@@ -557,5 +557,5 @@ extern "C" void TV_SB_GPU_main(float *Input, float *Output, float mu, int iter,
cudaFree(By);
cudaFree(Bz);
}
- cudaDeviceReset();
+ //cudaDeviceReset();
}
diff --git a/Core/regularisers_GPU/dTV_FGP_GPU_core.cu b/Core/regularisers_GPU/dTV_FGP_GPU_core.cu
index d4699f9..80a78da 100644
--- a/Core/regularisers_GPU/dTV_FGP_GPU_core.cu
+++ b/Core/regularisers_GPU/dTV_FGP_GPU_core.cu
@@ -749,5 +749,5 @@ extern "C" void dTV_FGP_GPU_main(float *Input, float *InputRef, float *Output, f
cudaFree(InputRef_z);
cudaFree(d_InputRef);
}
- cudaDeviceReset();
+ //cudaDeviceReset();
}
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