2008-03-10 20:40:35 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
#ifndef _COPROC_
|
|
|
|
#define _COPROC_
|
|
|
|
|
|
|
|
#include <vector>
|
2008-04-02 19:33:12 +00:00
|
|
|
#include <cstring>
|
2008-03-10 20:40:35 +00:00
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifdef _USING_FCGI_
|
|
|
|
#include "fcgi_stdio.h"
|
|
|
|
#endif
|
|
|
|
|
2008-04-01 15:08:47 +00:00
|
|
|
#include "miofile.h"
|
|
|
|
|
2008-03-10 20:40:35 +00:00
|
|
|
struct COPROC {
|
|
|
|
char name[256]; // must be unique
|
|
|
|
int count; // how many are present
|
2008-03-29 21:53:45 +00:00
|
|
|
int used; // how many are in use (used by client)
|
2008-03-10 20:40:35 +00:00
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2008-04-01 20:46:41 +00:00
|
|
|
virtual void write_xml(MIOFILE&);
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
2008-04-01 20:46:41 +00:00
|
|
|
COPROC(){
|
|
|
|
strcpy(name, "");
|
|
|
|
count = 0;
|
|
|
|
used = 0;
|
|
|
|
}
|
2008-03-10 20:40:35 +00:00
|
|
|
virtual ~COPROC(){}
|
2008-04-01 15:08:47 +00:00
|
|
|
int parse(MIOFILE&);
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct COPROCS {
|
2008-04-01 20:46:41 +00:00
|
|
|
std::vector<COPROC*> coprocs; // not deleted in destructor
|
|
|
|
// so any structure that includes this needs to do it manually
|
2008-03-10 20:40:35 +00:00
|
|
|
|
|
|
|
COPROCS(){}
|
2008-04-01 20:46:41 +00:00
|
|
|
~COPROCS(){}
|
|
|
|
void delete_coprocs(){
|
2008-03-31 16:19:45 +00:00
|
|
|
for (unsigned int i=0; i<coprocs.size(); i++) {
|
|
|
|
delete coprocs[i];
|
|
|
|
}
|
|
|
|
}
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2008-04-01 20:46:41 +00:00
|
|
|
void write_xml(MIOFILE& out) {
|
2008-04-01 15:08:47 +00:00
|
|
|
for (unsigned int i=0; i<coprocs.size(); i++) {
|
2008-04-01 20:46:41 +00:00
|
|
|
coprocs[i]->write_xml(out);
|
2008-04-01 15:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
2008-04-01 20:46:41 +00:00
|
|
|
void get();
|
|
|
|
int parse(FILE*);
|
|
|
|
COPROC* lookup(char*);
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// the following copied from /usr/local/cuda/include/driver_types.h
|
|
|
|
//
|
|
|
|
struct cudaDeviceProp {
|
|
|
|
char name[256];
|
|
|
|
size_t totalGlobalMem;
|
|
|
|
size_t sharedMemPerBlock;
|
|
|
|
int regsPerBlock;
|
|
|
|
int warpSize;
|
|
|
|
size_t memPitch;
|
|
|
|
int maxThreadsPerBlock;
|
|
|
|
int maxThreadsDim[3];
|
|
|
|
int maxGridSize[3];
|
|
|
|
size_t totalConstMem;
|
|
|
|
int major;
|
|
|
|
int minor;
|
|
|
|
int clockRate;
|
|
|
|
size_t textureAlignment;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct COPROC_CUDA : public COPROC {
|
|
|
|
cudaDeviceProp prop;
|
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2008-04-01 20:46:41 +00:00
|
|
|
virtual void write_xml(MIOFILE&);
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
2008-03-10 20:40:35 +00:00
|
|
|
virtual ~COPROC_CUDA(){}
|
|
|
|
static void get(COPROCS&);
|
2008-03-10 21:59:27 +00:00
|
|
|
void clear();
|
|
|
|
int parse(FILE*);
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct COPROC_CELL_SPE : public COPROC {
|
|
|
|
static void get(COPROCS&);
|
|
|
|
virtual ~COPROC_CELL_SPE(){}
|
|
|
|
};
|
|
|
|
|
2008-03-28 20:20:10 +00:00
|
|
|
void fake_cuda(COPROCS&);
|
|
|
|
|
2008-03-10 20:40:35 +00:00
|
|
|
#endif
|