[Rtk-users] error on build rtk in visual studio 2012 when rtk use cuda
Yang K Park
theday79 at gmail.com
Sat Jun 27 01:40:42 EDT 2015
Hi Safdary,
I’ve checked my up-to-date rtk source.
The FindCUDA_wrap.cmake file is located at “..\trunk\cmake” (Are you sure that you are using up-to-date rtk? If you are using old version located somewhere in “\tags\v1.0.0”, I’m recommending you to find another version in “trunk” directory.)
In that cmake file, I found that the problematic codes had been already commented out as below:
if("${CUDA_VERSION}" LESS 6.5)
# set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
# -gencode arch=compute_10,code=sm_10
# -gencode arch=compute_11,code=sm_11
# -gencode arch=compute_12,code=sm_12
# -gencode arch=compute_13,code=sm_13
# )
endif ()
if("${CUDA_VERSION}" LESS 5.0)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
-gencode arch=compute_20,code=compute_20
)
else()
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
-gencode arch=compute_30,code=sm_30
-gencode arch=compute_35,code=sm_35
-gencode arch=compute_35,code=compute_35
)
endif()
But it seems that your capture image is different from my up-to-date one.
If you are using some previous version of rtk ( such as 1.0.0, rc1.0_rc3), and really want to stick with it,
just try to replace the suspicious paragraph with following:
if(CUDA_VERSION_MAJOR LESS "6")
message (STATUS " >> Generation 1: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_10,code=sm_10
-gencode arch=compute_11,code=sm_11
-gencode arch=compute_12,code=sm_12
-gencode arch=compute_13,code=sm_13
)
else()
message (STATUS " >> Generation 1: [ ]")
endif()
if(CUDA_VERSION_MAJOR GREATER "2")
message (STATUS " >> Generation 2: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
)
else()
message (STATUS " >> Generation 2: [ ]")
endif()
if(CUDA_VERSION_MAJOR GREATER "4")
message (STATUS " >> Generation 3: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_30,code=sm_30
)
else()
message (STATUS " >> Generation 3: [ ]")
endif()
if(CUDA_VERSION_MAJOR GREATER "5")
message (STATUS " >> Generation 5: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_50,code=sm_50
-gencode arch=compute_50,code=compute_50
)
else()
message (STATUS " >> Generation 5: [ ]")
endif()
Again, I think you would not face CUDA issue with up-to-date version of rtk (which is in “trunk” directory).
Hope this helps.
Yang
__________________________________________
From: safdary mohsen [mailto:ieee.safdary at gmail.com]
Sent: Saturday, June 27, 2015 12:48 AM
To: Yang K Park
Subject: Re: [Rtk-users] error on build rtk in visual studio 2012 when rtk use cuda
Hi Yang
So you are guess that remove --gencode arch=compute_10,code=sm_10 from cmake file(findcuda_wrap) couses this problem!!!
have you any suggestion?
On Fri, Jun 26, 2015 at 10:33 AM, safdary mohsen <ieee.safdary at gmail.com <mailto:ieee.safdary at gmail.com> > wrote:
Hi Yang
i am use this command and the result is ok but in cuda mode not.
rtkfdk --geometry geometry.xml --regexp .*.hnd --path Scan0 --output slice30.mha --verbose --spacing 0.25,0.25,0.25 --dimension 1024,1,1024 --origin -127.875,30,-127.875 --hardware cpu)
and screen shot of my cuda version is attached (v6.5)
On Fri, Jun 26, 2015 at 10:22 AM, safdary mohsen <ieee.safdary at gmail.com <mailto:ieee.safdary at gmail.com> > wrote:
Hi Cyril Mory
I am using example dataset for Varian from RTK website.
But i am using 86 projections insted of 686:
Proj_00000.hnd , Proj_00008.hnd , Proj_00012.hnd +(steps : 8) ..., Proj_00280.hnd, Proj_00288.hnd, ....,Proj_00672.hnd, Proj_00680.hnd
and my geometry file is atached to mail
On Thu, Jun 25, 2015 at 8:25 PM, Yang K Park <theday79 at gmail.com <mailto:theday79 at gmail.com> > wrote:
Hi Safdary,
I’m a bit confused because the attached source code is not original rtkfdk source code.
So, my point about genuine rtkfdk means,
1. Update your rtk source
2. Don’t change any source code and just compile them.
3. Use the example dataset for Varian from RTK website.
4. In the command prompt, run the command line (“rtkfdk …”)
I guess you already did the above things, and then you could see something with CPU option but nothing in your cuda-based reconstruction.
If that is the case, I’m suspecting your CUDA/Graphic driver and cuda implementation such as CUDA-compute_10 error you might have faced during RTK compiling.
To be honest, I have no idea how to deal with such issues.(Sorry about that)
Yang
From: safdary mohsen [mailto: <mailto:ieee.safdary at gmail.com> ieee.safdary at gmail.com]
Sent: Thursday, June 25, 2015 1:28 AM
To: Yang-Kyun Park
Cc: <mailto:rtk-users at openrtk.org> rtk-users at openrtk.org; Cyril Mory
Subject: Re: [Rtk-users] error on build rtk in visual studio 2012 when rtk use cuda
Hi
what is genuine rtkfdk.exe ?
source code is attached to mail and command line is:
rtkfdk --geometry geometry.xml --regexp .*.hnd --path Scan0 --output slice30.mha --verbose --spacing 0.25,0.25,0.25 --dimension 1024,1,1024 --origin -127.875,30,-127.875 --hardware cuda
On Wed, Jun 24, 2015 at 5:51 PM, Yang-Kyun Park <theday79 at gmail.com <mailto:theday79 at gmail.com> > wrote:
Hi Safdary,
So you might have tried the genuine rtkfdk.exe for your recon. Would you give me your command line you used?
Yang
On Jun 24, 2015 3:48 AM, "safdary mohsen" <ieee.safdary at gmail.com <mailto:ieee.safdary at gmail.com> > wrote:
Hi
I cheched projectionreader and i abtained that all projection are readed.
( by using:
typedef itk::ImageFileWriter<OutputImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( "reader.mha" );
writer->SetInput( reader->GetOutput() );
writer->Update();
)
and
geometry is work for cpu mode means outputs are ok .
I am confused for solving this problem!!!!!!!!!!!!!!!!!
On Tue, Jun 16, 2015 at 11:09 AM, Cyril Mory <cyril.mory at creatis.insa-lyon.fr <mailto:cyril.mory at creatis.insa-lyon.fr> > wrote:
Hi Safdary,
Just to be sure: have you tried reconstructing in a larger volume (something really huge), just to make sure you are not trying to reconstruct some portion of space where, indeed, there is nothing ?
You can try that easily, just replace your spacing, dimension and origin with
--spacing 16,16,16 --dimension 256,256,256 --origin -2040,-2040,-2040
in your rtkfdk command line.
Cyril
On 06/15/2015 05:19 PM, safdary mohsen wrote:
Hi Yang
I am use rtkfdk.exe but the results are same as my code,
means all pixels are zero!!!
regards
safdari
On Mon, Jun 15, 2015 at 7:10 PM, Yang K Park <theday79 at gmail.com <mailto:theday79 at gmail.com> > wrote:
Hi Safdary,
Again, please cc <mailto:rtk-users at openrtk.org> rtk-users at openrtk.org when you send your email, since other users (much better experts than me!) can give us any suggestions.
Thanks.
Yang
From: Yang K Park [mailto: <mailto:theday79 at gmail.com> theday79 at gmail.com]
Sent: Monday, June 15, 2015 10:37 AM
To: 'safdary mohsen'
Cc: <mailto:rtk-users at openrtk.org> rtk-users at openrtk.org
Subject: RE: [Rtk-users] error on build rtk in visual studio 2012 when rtk use cuda
Hi Safdary,
I recommend you to try rtkfdk.exe first (with cuda option) to see if it works for you.
The example of the command line would be:
rtkfdk --geometry geom.xml --path proj_dir --regexp .*.his --output test_output.mha --verbos --spacing 1,1,1 --dimension 512,10,512 --origin -127.875,29.5,-127.875 --hardware cuda
If it works for your image, then you can mimic the original rtkfdk code to make your own one.
Good luck!
Yang
From: safdary mohsen [ <mailto:ieee.safdary at gmail.com> mailto:ieee.safdary at gmail.com]
Sent: Saturday, June 13, 2015 11:58 PM
To: Yang K Park
Subject: Re: [Rtk-users] error on build rtk in visual studio 2012 when rtk use cuda
Hi Yang
I have tried to adjust the window/level to see something inside of the image but all pixels set to zero.
My code is:
#define USE_CUDA
int main(int , char **)
{
//// variable
const unsigned int Dimension = 3;
typedef float OutputPixelType;
#ifdef USE_CUDA
typedef itk::CudaImage< OutputPixelType, Dimension > OutputImageType;
#else
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// Generate file names of projections
itk::RegularExpressionSeriesFileNames::Pointer names = itk::RegularExpressionSeriesFileNames::New();
names->SetDirectory(std::string("d://RTK/build/bin/Release/Scan1/"));
names->SetRegularExpression(std::string("Proj_.*.hnd"));
////////////////////////////////////////////////////////////////////////////////////////////////////
//// geometry
// Defines the RTK geometry object
typedef rtk::ThreeDCircularProjectionGeometry GeometryType;
GeometryType::Pointer geometry = GeometryType::New();
// Projection matrices
unsigned int numberOfProjections = 86;
unsigned int firstAngle = 0;
unsigned int angularArc = 360;
unsigned int sid = 1000;
unsigned int sdd = 1200;
int isox = 0;
int isoy = 0 ;
for(unsigned int noProj=0; noProj<numberOfProjections; noProj++)
{
double angle = (float)firstAngle + (float)noProj * angularArc / (float)numberOfProjections;
geometry->AddProjection(sid,
sdd,
angle,
isox,
isoy);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Projections reader
typedef rtk::ProjectionsReader< OutputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileNames(names->GetFileNames());
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create reconstructed image ////////////////////////////////////
typedef rtk::ConstantImageSource< OutputImageType > ConstantImageSourceType;
ConstantImageSourceType::Pointer ImageSource = ConstantImageSourceType::New();
ConstantImageSourceType::PointType origin;
ConstantImageSourceType::SizeType sizeOutput;
ConstantImageSourceType::SpacingType spacing;
origin[0] = -127.75;
origin[1] = -127.75;
origin[2] = -127.75;
sizeOutput[0] = 512;
sizeOutput[1] = 512;
sizeOutput[2] = 512;
spacing[0] = .5;
spacing[1] = .5;
spacing[2] = .5;
ImageSource->SetOrigin( origin );
ImageSource->SetSpacing( spacing );
ImageSource->SetSize( sizeOutput );
ImageSource->SetConstant( 0. );
// getchar(); //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::cout << "Performing reconstruction" << std::endl;
// FDK reconstruction filtering
// FDK reconstruction filtering
#ifdef USE_CUDA
typedef rtk::CudaFDKConeBeamReconstructionFilter FDKType;
#elif USE_OPENCL
typedef rtk::OpenCLFDKConeBeamReconstructionFilter FDKType;
#else
typedef rtk::FDKConeBeamReconstructionFilter< OutputImageType > FDKType;
#endif
FDKType::Pointer feldkamp = FDKType::New();
feldkamp->SetInput( 0, ImageSource->GetOutput() );
feldkamp->SetInput( 1, reader->GetOutput());
feldkamp->SetGeometry( geometry);
TRY_AND_EXIT_ON_ITK_EXCEPTION( feldkamp->Update() );
std::cout << "Writing output image" << std::endl;
// Writer
typedef itk::Image< float, 3 > ImageType;
typedef itk::ImageFileWriter<ImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( "output11.mha" );
writer->SetInput( feldkamp->GetOutput() );
writer->Update();
getchar();
return 0;
}
_______________________________________________
Rtk-users mailing list
Rtk-users at public.kitware.com <mailto:Rtk-users at public.kitware.com>
http://public.kitware.com/mailman/listinfo/rtk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20150627/4743e936/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 148571 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20150627/4743e936/attachment-0002.png>
More information about the Rtk-users
mailing list