AlignRMSD.cu 3.2 KB
Newer Older
karius's avatar
karius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
/*
 * AlignRMSD.cu
 *
 *  Created on: Jul 4, 2019
 *      Author: kkarius
 */

#include <IMP/rmf/atom_io.h>
#include <RMF/FileHandle.h>
#include <RMF.h>
#include <RMF/internal/SharedData.h>
#include <RMF/internal/shared_data_factories.h>
#include <IMP/flags.h>
#include <IMP/atom/pdb.h>
#include <IMP/rmf/frames.h>
#include <IMP/atom/force_fields.h>
#include <IMP/Model.h>
#include <string>


int main(){
	std::string rmf_name = "/home/kkarius/junk/test_rmfs/run_109_frame_6963.rmf3";
	RMF::FileHandle rmf_fh;
	RMF::internal::create_file(rmf_name);
//	IMP::Model m;

//	int N = 256;

//		int mx = 300;
//		float xlen = 312.3f;
//		float host_DSHIFT[sizeof(float) * 3];
//		host_DSHIFT[0] = xlen / mx;
//		host_DSHIFT[1] = xlen / mx;
//		host_DSHIFT[2] = xlen / mx;

//		float host_DSIZE[sizeof(int) * 3];
//		host_DSIZE[0] = N;
//		host_DSIZE[1] = N;
//		host_DSIZE[2] = N;
//		cudaMemcpyToSymbol(DSIZE, host_DSIZE, sizeof(int) * 3);

		//TODO:sanity check on user inputs
//		float data_R = 1.041f;
//		float feat_R = 1.5f;
//		int cutoff_sigma = 3;
//		int charge = 6; //carbon
//		size_t array_size = getSizeGaussian(feat_R, data_R, cutoff_sigma);

		//TODO: sanity check on size
//		float* gaussian;
//		gaussian = (float *) malloc(array_size * sizeof(float));
//		createGaussian(gaussian, feat_R, cutoff_sigma, charge, array_size);

	//	float h_data[3][3];
	//	for (int i = 0; i < 3; i++)
	//		for (int j = 0; j < 3; j++)
	//			h_data[i][j] = i * j;

	//	int size = width * height * sizeof(float);
		// Allocate CUDA array in device memory
//		cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0,
//				cudaChannelFormatKindFloat);
//		cudaArray* cuArray;
//		cudaMallocArray(&cuArray, &channelDesc, array_size);

		// Copy to device memory some data located at address h_data
		// in host memory
//		cudaMemcpyToArray(cuArray, 0, 0, gaussian, array_size,
//				cudaMemcpyHostToDevice);

		// Set texture reference parameters
//		texRef.addressMode[0] = cudaAddressModeWrap;
	//	texRef.addressMode[1] = cudaAddressModeWrap;
//		texRef.filterMode = cudaFilterModeLinear;
	//	texRef.normalized = true;
	//
	//	// Bind the array to the texture reference
//		cudaBindTextureToArray(texRef, cuArray, channelDesc);
//
//		float* host_output;
//		host_output = (float *) malloc(N*N*N*sizeof(float));
//		float* output;
//		cudaMalloc(&output, N * N * N * sizeof(float));
	//
	//	// Allocate result of transformation in device memory
	//	float* output;
	//	cudaMalloc(&output, width * height * sizeof(float));
	//
	//	// Invoke kernel
//		int total = N*N*N;
//		int per_thread = N*16;
//		int per_block = N*N*16;
//		printf("Up to here\n");
//		transformKernel<<<16, 256>>>(output,total,per_thread,per_block);
//		printf("Even here\n");
	//
	//    printf ("\n After operation \n ");
	//    for ( int i =0 ; i<3 ; i++ )
	//    {
	//          for ( int j = 0 ; j<3; j++ )
	//                            printf ("%f ", h_data [i][j] );
	//
	//          printf ("\n");
	//    }
	//
	//	// Free device memory
	//	cudaFreeArray(cuArray);
//		cudaMemcpy(host_output,output,total*sizeof(float),cudaMemcpyDeviceToHost);
//		printf("And here\n");
//		printf ("output[0]:%f\n",host_output[257]);
//		printf("But not here\n");
//		cudaFree(output);
//		free(host_output);

}