1 / 9

MPI-DB

MPI-DB. A parallel software library providing database services to scientific computing processes. E. Givelberg Department of Physics IDIES JHU. MPIDB: create data structures. 1 #include ”mpidb.h”  22  23  24 int  25 main( int  argc, char  **argv)  26 {

Download Presentation

MPI-DB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MPI-DB A parallel software library providing database services to scientific computing processes E. Givelberg Department of Physics IDIES JHU

  2. MPIDB: create data structures 1 #include ”mpidb.h”  22  23  24 int  25 main(int argc, char **argv)  26 {  27     mpidb::start(argc, argv);  28  29 if (mpidb::NumberOfProcessors() != 2)  30         mpidb::exit("This demo is for 2 processors only.");  31  32 // create the data structures  33  34 // int n = 128;  35 int n = 8;  36 int halfn = n / 2;  37 int n1 = n;  38 int n2 = n;  39 int n3 = n;  40 int n31 = mpidb::MyID() * halfn;  41 int n32 =  mpidb::MyID() * halfn + halfn - 1;  42  43     mpidb::Domain * domain1  44         = new mpidb::Domain(0, n1 - 1, 0, n2 - 1, n31, n32);  45  46     mpidb::Array * a = new mpidb::Array(domain1, mpidb::DOUBLE);

  3. MPIDB: create data structures  48 int N = n * n * halfn;  49 double * data = newdouble[N];  50  51 for (int i1 = 0;  i1 < n1; i1 ++)  52 for (int i2 = 0;  i2 < n2; i2 ++)  53 for (int i3 = 0;  i3 < halfn; i3 ++)  54     {  55         data[i1 * n2 * n3 + i2 * n3 + i3] = 100.0 + mpidb::MyID();  56     }  57  58     ostringstream name;  59     name << "test" << mpidb::MyID();  60  61     mpidb::DataStream * s = new mpidb::DataStream(a, name.str().c_str());  62  63     mpidb::DataSet * d = new mpidb::DataSet(name.str().c_str());  64  65     d->AddStream(s);  66

  4. MPIDB: connect to server 66  67  68 // get the port name of the master server for MPI-DB  69  70     std::ifstream i;  71     i.open(mpidb::ServerAddressFilename);  72 char ServerAddress [MPI_MAX_PORT_NAME];  73     i.getline(ServerAddress, MPI_MAX_PORT_NAME);  74     i.close();  75  76  77 if (mpidb::MyID() == 0)  78         cerr << "Connecting to server address: " << ServerAddress << endl;  79  80     mpidb::Connection * c = new mpidb::Connection();  81  82 if (!c->ConnectToServer(ServerAddress))  83     {  84         mpidb::exit("failed to connect to server... disconnecting");  85     }  86  87  88

  5. MPIDB: access database server 93  94  95     mpidb::DBType dbtype;  96 #ifdef MySQL  97     dbtype = mpidb::MySQLDB;  98 #endif  99 #ifdef SQLServer 100     dbtype = mpidb::SQLServerDB; 101 #endif 102 103 104 if (!c->AccessDBServer(dbtype, "localhost", "mpidb", ”testuser", ”password")) 105     { 106 delete c; 107         mpidb::exit("failed to access the database"); 108     } 109

  6. MPIDB: create data set 115 116 if (!d->CreateAndBindToDatabase(c)) 117     { 118 delete c; 119         mpidb::exit("failed to create a new data set"); 120     } 121 124 125 if (!s->PushData(c, data)) 126     { 127 delete c; 128         mpidb::exit("failed to store the data"); 129     } 130 131     c->DisconnectFromServer(); 136 139     mpidb::finish(); 140 141 return0; 142 143 }   // main

  7. User Management Layer client server Simulation Data Layer client server Database Access Layer client server database MPI Transport Layer client server network connection

  8. Thank you!

More Related