00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GPUMATRIX
00009 #define GPUMATRIX
00010 #ifdef QMC_GPU
00011
00012 #include <iostream>
00013 #include <stdlib.h>
00014 #include <assert.h>
00015 #include <math.h>
00016 #include <string>
00017 #include <vector>
00018 #include <sstream>
00019
00020 #include "GPUGlobals.h"
00021 #include "GPUQMCFramebuffer.h"
00022 #include "Array1D.h"
00023 #include "Array2D.h"
00024 #include "Stopwatch.h"
00025 #include "QMCInput.h"
00026
00033 class GPUQMCMatrix : public GPUGlobals
00034 {
00035 public:
00036 GPUQMCMatrix();
00037
00042 GPUQMCMatrix(QMCInput *Input, Array1D< Array2D<qmcfloat> > & Coeffs, int numCalcs);
00043
00048 void destroy();
00049
00065 int runCalculation(int numCalcs, GLuint bfInput);
00066
00073 void getResults(Array2D< Array2D<float>* > & results);
00074
00081 int getNumIterations();
00082
00083 private:
00090 string generateShader(int start, int stop, bool isFirstPass);
00091
00092
00093
00094
00095 void loadShaders();
00096
00104 void loadData(ArrayGPU & data, GLuint & textureID, int numRows, int numCols);
00105
00111 inline int operandMapping(int r, int c, int i, int j, int numCols);
00112
00121 void mapData(ArrayGPU & data, int numRows, int numCols);
00122
00123 QMCInput *Input;
00124
00129 GLuint * coTexID;
00130
00135 const static int nMats = 5;
00136
00142 int nRows, nCols;
00143
00146 int nDets, nOrbitals, nBasisF;
00147
00151 int deltaOE, deltaBF;
00152
00158 int deltaW, deltaH;
00159
00164 static vector<CGprogram> fp;
00165
00170 static vector<CGparameter> tELxBF, tORxBF;
00171
00177 static vector< vector<CGparameter> > tELxOR;
00178
00182 int numLoops;
00183
00189 int numPasses;
00190
00196 int resultsIn;
00197
00201 GPUQMCFramebuffer * gpuDataFB;
00202
00208 GLfloat * cpuData;
00209
00214 GLfloat * pixelData;
00215 };
00216 #endif
00217 #endif