Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access MySQL from MPI program (use MPICH2)?
    primarykey
    data
    text
    <p>I have huge database (DBMS = MySQL) that I access from an MPI program (using MPICH2). In this program, I just want to know about time to execute sql query. It's reference to my other parallel program.</p> <p>When the code's run from Visual Studio C++, it runs well (I get the output). But when it's runed use <code>mpiexec</code>, there's no output and no error message. Otherwise, when I try a simple program (no mysql code, use mpiexec), it runs well (there is output). Should I not be using the mysql and mpi libraries together?</p> <p>The code like this : </p> <pre><code>#include &lt;stdio.h&gt; #include &lt;windows.h&gt; #include &lt;mysql.h&gt; #include &lt;iostream&gt; #include &lt;winsock.h&gt; #include &lt;mpi.h&gt; #include &lt;stdlib.h&gt; using namespace std; //namespace for error handling namespace ekception{ struct error{ const char *p; error(const char *q){ p=q; } }; } int main(int argc, char *argv[]){ MYSQL mysql,*sock; MYSQL_RES *res; int state; char *host="localhost"; char *user="root"; char *password=""; char *dbName="sp"; double start,finish,time; long j; char s[]="SELECT COUNT(kolom2) FROM coba WHERE kolom1&lt;="; char query[BUFSIZ]; MPI_Init(&amp;argc,&amp;argv); for(j=250000;j&lt;=25000000;j+=250000){ sprintf_s(query,"%s%d",s,j); start=MPI_Wtime(); try{ mysql_init(&amp;mysql); if(!(sock=mysql_real_connect(&amp;mysql,host,user,password,dbName,0,NULL,0))){ throw ekception::error("Connection failed\n"); } mysql.reconnect=1; state=mysql_query(sock,query); if(state!=0){ throw ekception::error("Query execution Failed\n"); } res=mysql_store_result(sock); mysql_free_result(res); mysql_close(sock); } catch(ekception::error e){ printf("%s\n",e.p); } finish=MPI_Wtime(); time=finish-start; printf("Data size = %d *** time = %f\n",j,time); } MPI_Finalize(); getchar(); return 0; } </code></pre> <p>Thanks in Advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload