     
     
     
-    cudaMemcpy(result, dimage, num_bytes, cudaMemcpyDeviceToHost);
+    cudaMemcpy(result, dimage, num_bytes_img, cudaMemcpyDeviceToHost);
     cudaCheckErrors("cudaMemcpy result fail");
     
-    cudaUnbindTexture(tex);
-    cudaCheckErrors("Unbind  fail");
+    //cudaUnbindTexture(tex);
+    //cudaCheckErrors("Unbind  fail");
     
     cudaFree(dimage);
-    cudaFreeArray(d_projectiondata);
+    //cudaFreeArray(d_projectiondata);
     cudaCheckErrors("cudaFree d_imagedata fail");
     cudaDeviceReset(); // For the Nvidia Visual Profiler
     return 0;

        size_t mem_free=mem_GPU_global-nalpha*mem_proj;
        // How many slices can we fit on the free memory we have? We'd like to keep these slices full as it increases
        // the kernels performance to run image chuncks that are VOXELS_PER_THREAD in z.
        unsigned int max_slices_img_gpu=mem_image_slice/mem_free;
        unsigned int total_slices_img=(geo.nVoxelZ+VOXELS_PER_THREAD-1)/VOXELS_PER_THREAD;
        // if we have multi GPU we want to split in a way that ensures both have the same amount of work.
        if (deviceCount>1){
            // Do we need an array here to evenly distribute computation?

     *
     **/
    
void CreateTexture(int num_devices,const float* projectiondata,Geometry geo,cudaArray** d_cuArrTex,unsigned int nangles, cudaTextureObject_t *texImage);

    
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
