     
     
     
-    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;

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

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

    unsigned int split_image;
    unsigned int split_projections;
    // Does everything fit in the GPU?
//     mexPrintf("Memory requirements:\n");
//     mexPrintf("mem_image: %zu\n",mem_image );
//     mexPrintf("mem_image_slice: %zu\n",mem_image_slice );
//     mexPrintf("mem_proj: %zu\n",mem_proj );
//     mexPrintf("mem_GPU_global: %zu\n",mem_GPU_global );
//     mexPrintf("\n");
    if(mem_image+mem_proj*nalpha<mem_GPU_global){
        // We only need to split if we have extra GPUs
        fits_in_memory=true;
        split_image=1;
        split_projections=1;
        mexPrintf("No splits needed\n");
    }
    // We know we need to split, but:
    // Do all projections fit on the GPU (with some slack for the image)??
