1 / 14

PANINI

PANINI. Harshit Sahay Shuchi Agarwal Sumeet Jindal. Introduction. Panini is a language for parallel computing over multiple machines We have named our language after the Sanskrit grammarian, Panini Using Panini the task is distributed among different machines specified by the user.

mina
Télécharger la présentation

PANINI

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. PANINI Harshit Sahay Shuchi Agarwal Sumeet Jindal

  2. Introduction • Panini is a language for parallel computing over multiple machines • We have named our language after the Sanskrit grammarian, Panini • Using Panini the task is distributed among different machines specified by the user

  3. Features of Panini • Panini is a declarative language • Panini is simple and easy-to-use • Panini is flexible

  4. Panini Architecture VC++ compiler Programmer’s VC++ project sample.cpp Panini compiler sample.panini

  5. Communication between the machines Servicing machine output2 Requesting machine Libname+funcname+data2 output1 Servicing machine output0 Libname+funcname+data1 Libname+funcname+data0 Servicing machine

  6. A sample PANINI program PANINI { CREATE NODE n1="209.2.235.32"; CREATE NODE n2="209.2.226.71"; { LIBNAME “D:\libdll.dll" FUNCTIONNAME "word_count" } }

  7. char * n1="209.2.235.32"; char * n2="209.2.226.71"; bstr_t nodes_array[]={"209.2.235.32","209.2.226.71"}; void Create_Queue() {…} void libdll_word_count_Fire(char *function_inputs[],int number_of_tasks,char *guids[]) { CString library_name="libdll.dll"; CString function_name="word_count"; IMSMQQueueInfoPtr spQInfo("MSMQ.MSMQQueueInfo"); IMSMQQueuePtr spQSend; for(loop_i=0;loop_i<number_of_tasks;loop_i++) { IMSMQMessagePtr spQMsg("MSMQ.MSMQMessage"); spQMsg->Label = g; spQMsg->Body = BSTR(paniniMessage); spQMsg->Delivery = MQMSG_DELIVERY_RECOVERABLE; spQMsg->Send(spQSend); } } sample.cpp

  8. sample.cpp(contd.) void Wait_For_Output(char *guids[],int number_of_guids,char *output[]) {) IMSMQQueueInfoPtr spQInfo1("MSMQ.MSMQQueueInfo"); IMSMQMessagePtr spRMsg; spRMsg= spQRec->PeekCurrent(&vtMissing, &vtMissing); while(1) { for(guid_i=0;guid_i<number_of_guids;guid_i++) { if(_stricmp((char*)spRMsg->Label,guids[guid_i])==0) num_of_guids_matched++; break; } if(guid_i<number_of_guids) { spRMsg=spQRec->ReceiveCurrent(&vtMissing, &vtMissing, &vtMissing); temp_str=spRMsg->Body; while(a<length) output[guid_i][a]=(char)temp_str.GetAt(a); if(num_of_guids_matched!=number_of_guids) {spRMsg= spQRec->PeekCurrent(&vtMissing, &vtMissing); } } else spRMsg=spQRec->PeekNext(&vtMissing, &vtMissing); } }

  9. //user_code.cpp #include”sample.cpp”//output of Panini int _tmain(int argc, _TCHAR* argv[]){ CoInitialize(NULL); char *arr[]={"C:\\data1.txt","C:\\data2.txt","C:\\data3.tx t","C:\\data4.txt"}; char *output[8]; char *guids[8]; Create_Queue(); libdll_word_count_Fire(arr,4,guids);Wait_For_Output(guids,4,output); int no_words=0; for(int i=0;i<7;i++) no_words+=atoi(output[i]); cout<<"Total number of words in all files"<<no_words<<endl; CoUninitialize(); return 0; } //sample.cpp void Create_Queue(){ ... } void libdll_word_count_Fire(char *function_inputs[],int number_of_tasks,char *guids[]){ ... } void Wait_For_Output(char *guids[],int number_of_guids,char *output[]){ ... } Including and using Panini output in user code

  10. Keywords of Panini • PANINI • CREATE • NODE • LIBNAME • FUNCTIONNAME

  11. Service running on all machines int Receive() { /***********OPEN AND RECEIVE MESSAGE BEGIN**********/ IMSMQMessagePtr ReceiveMsg = ReceiveQueuePtr->Receive(&vtMissing, &vtMissing, &vtMissing, &vtReceiveTimeout); /************PARSE RECEIVED MESSAGE BEGIN*************/ while (resToken != ""){ if(i == 1) ipaddr = resToken; if(i == 2) libName = (LPCWSTR)resToken; if(i == 3) funcName = resToken; if(i == 4) inputToFunc = resToken; resToken = msg.Tokenize(_T("*"), cur_pos); i++; } /*************LOAD LIB + FUNCTION CALL BEGIN****************/ FunctionPtr = (FunctionType)GetProcAddress((HMODULE)hLib, funcName_1); FunctionPtr(input_to_function, output_from_function); /***************SEND MESSAGE BEGIN***********************/ BSTR bstr_paniniMessageOut = outMsg.AllocSysString(); ipaddr = "DIRECT=TCP:" + ipaddr + "\\PRIVATE$\\listening_queue"; Send(bstr_FormatName, bstr_guid, bstr_paniniMessageOut); return 0; }

  12. Development tools and environment • Visual Studio 2005 • Microsoft Message Queueing(MSMQ) • Lex and Yacc • Google Docs

  13. Test Plan • Every grammar production was tested • Testing communication between machines was a major component of testing

  14. Conclusion • Great learning experience • Learnt about message queuing • Realized that implementing parallel computing is not so easy • We achieved our basic objective-to create a language for parallelizing tasks • So, if you have some set of instructions which you want to easily execute over multiple sets of data, then use our language

More Related