What is this .dcf format? 'read_nd_array' only supports the simple header+data format described in the manual/wiki. What are the dimensions of the host array after creation?
/ Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here I create a hoNDArray with the dimensions 500 x 10 and also get_size(0) returns 500 and get_size(1) returns 10 as expected. Nevertheless when I execute the next line to create the cuNDArray I get:
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 0 [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 117] Gadget (RpeAccumulateGadget) thread finished
Segmentation fault (core dumped)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a bit of a strange error. Most of the things that could go wrong when creating a cuNDArray would result in a cuda_error being thrown, rather than a segmentation fault.
Do you also get the error if you create the cuNDArray<float> directly, and not in a shared_ptr or via new?</float>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This leads to the following error message similar to the one posted above:
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 0 [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 117] Gadget (RpeAccumulateGadget) thread finished
Segmentation fault (core dumped)
2.Run the above code inside Gadget B (gpuRpeGridGadget) and in another Gadget A (RpeAccumulateGadget) which is placed BEFORE Gadget B:
This leads to the following messages: [file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 342] Start creating cuNDArray... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/GadgetStreamController.cpp, line 80] Received close signal from client. Closing stream... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 1 [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 115] Gadget (RpeAccumulateGadget) waiting for thread to finish [file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 348] cuNDArray [500 10]
and then a bit later
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray... [file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 271] cuNDArray [500 10]
This means to me that there is a problem when creating the cuNDArray in Gadget A but it manages to do it and this then means that the cuNDArray can be created successfully in the following Gadget B.
Does this make sense to anyone? I am grateful for any ideas or suggestions where I should be looking for the mistake.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Could you run this in a debugger and figure out which line causes the segfault?
Sent from a mobile device - please excuse brevity and/or typos.
On Jun 18, 2014, at 8:11 AM, "Christoph Kolbitsch" ck09@users.sf.net wrote:
I definitely agree that this is strange.
I tried the following:
1.Run the following code inside Gadget B (gpuRpeGridGadget):
GADGET_DEBUG1("Start creating cuNDArray...\n");
std::vector< size_t > dcf_dim(2);
dcf_dim[0] = 500; dcf_dim[1] = 10;
cuNDArray* dcf_cu;
dcf_cu = new cuNDArray();
dcf_cu->create(&dcf_dim);
GADGET_DEBUG2("cuNDArray [%d %d]\n", dcf_cu->get_size(0), dcf_cu->get_size(1));
This leads to the following error message similar to the one posted above:
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 0 [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 117] Gadget (RpeAccumulateGadget) thread finished
Segmentation fault (core dumped)
2.Run the above code inside Gadget B (gpuRpeGridGadget) and in another Gadget A (RpeAccumulateGadget) which is placed BEFORE Gadget B:
This leads to the following messages: [file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 342] Start creating cuNDArray... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/GadgetStreamController.cpp, line 80] Received close signal from client. Closing stream... [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 1 [file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 115] Gadget (RpeAccumulateGadget) waiting for thread to finish [file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 348] cuNDArray [500 10]
and then a bit later
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray... [file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 271] cuNDArray [500 10]
This means to me that there is a problem when creating the cuNDArray in Gadget A but it manages to do it and this then means that the cuNDArray can be created successfully in the following Gadget B.
Does this make sense to anyone? I am grateful for any ideas or suggestions where I should be looking for the mistake.
Also, can you confirm that the Cuda samples (from the Cuda SDK) run? - e.g. deviceQuery. If you have Cuda installed with the wrong driver you might be able to compile Gadgetron but encounter errors at runtime.
/ Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I finally found time to look into this problem again.
When I looked at the segmentation fault with a debugger I found out that the error occurs when the destructor of an boost:shared_ptr to an hoNDArray is called.
I am not really sure how this is linked to my code fragment of creating a cuNDArray but it seems this hoNDArray is linked via a boost:shared_ptr to a global variable in one of my gadgets. In the destructor of this gadget I delete this global variable. Nevertheless, this does seem to cause problems with the boost:shared_ptr destructor.
I changed this variable from being global to a local variable and now it seems to be working fine.
Thank you for your suggestions.
Regards,
Christoph
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I tried to create a cuNDArray from an hoNDArray which I loaded from file:
When I try to run this code I get a segmentation fault for the second line
Does somebody know what I am doing wrong here?
What is this .dcf format? 'read_nd_array' only supports the simple header+data format described in the manual/wiki. What are the dimensions of the host array after creation?
/ Thomas
I created the file "data.dcf" with the write_nd_array function. Nevertheless, I have reduced the problem to something a bit more reproducible:
Here I create a hoNDArray with the dimensions 500 x 10 and also get_size(0) returns 500 and get_size(1) returns 10 as expected. Nevertheless when I execute the next line to create the cuNDArray I get:
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 0
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 117] Gadget (RpeAccumulateGadget) thread finished
Segmentation fault (core dumped)
This is a bit of a strange error. Most of the things that could go wrong when creating a cuNDArray would result in a cuda_error being thrown, rather than a segmentation fault.
Do you also get the error if you create the cuNDArray<float> directly, and not in a shared_ptr or via new?</float>
I definitely agree that this is strange.
I tried the following:
1.Run the following code inside Gadget B (gpuRpeGridGadget):
This leads to the following error message similar to the one posted above:
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray...
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 0
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 117] Gadget (RpeAccumulateGadget) thread finished
Segmentation fault (core dumped)
2.Run the above code inside Gadget B (gpuRpeGridGadget) and in another Gadget A (RpeAccumulateGadget) which is placed BEFORE Gadget B:
This leads to the following messages:
[file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 342] Start creating cuNDArray...
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/GadgetStreamController.cpp, line 80] Received close signal from client. Closing stream...
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 105] Gadget (RpeAccumulateGadget) Close Called with flags = 1
[file /data/ck09/GADGETRON/gadgetron/apps/gadgetron/Gadget.h, line 115] Gadget (RpeAccumulateGadget) waiting for thread to finish
[file /data/ck09/projects_ck09/GadgetronRecon/RpeAccumulateGadget.cpp, line 348] cuNDArray [500 10]
and then a bit later
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 265] Start creating cuNDArray...
[file /data/ck09/projects_ck09/GadgetronRecon/gpuRpeGridGadget.cpp, line 271] cuNDArray [500 10]
This means to me that there is a problem when creating the cuNDArray in Gadget A but it manages to do it and this then means that the cuNDArray can be created successfully in the following Gadget B.
Does this make sense to anyone? I am grateful for any ideas or suggestions where I should be looking for the mistake.
Could you run this in a debugger and figure out which line causes the segfault?
Sent from a mobile device - please excuse brevity and/or typos.
Also, can you confirm that the Cuda samples (from the Cuda SDK) run? - e.g. deviceQuery. If you have Cuda installed with the wrong driver you might be able to compile Gadgetron but encounter errors at runtime.
/ Thomas
I finally found time to look into this problem again.
When I looked at the segmentation fault with a debugger I found out that the error occurs when the destructor of an boost:shared_ptr to an hoNDArray is called.
I am not really sure how this is linked to my code fragment of creating a cuNDArray but it seems this hoNDArray is linked via a boost:shared_ptr to a global variable in one of my gadgets. In the destructor of this gadget I delete this global variable. Nevertheless, this does seem to cause problems with the boost:shared_ptr destructor.
I changed this variable from being global to a local variable and now it seems to be working fine.
Thank you for your suggestions.
Regards,
Christoph