Title: PANINI
1PANINI
- Harshit Sahay
- Shuchi Agarwal
- Sumeet Jindal
2Introduction
- 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
3Features of Panini
- Panini is a declarative language
- Panini is simple and easy-to-use
- Panini is flexible
4Panini Architecture
VC compiler
Programmers VC project
sample.cpp
Panini compiler
sample.panini
5Communication between the machines
Servicing machine
output2
Requesting machine
Libnamefuncnamedata2
output1
Servicing machine
output0
Libnamefuncnamedata1
Libnamefuncnamedata0
Servicing machine
6A 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"
-
-
7sample.cpp
- 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_i0loop_iltnumber_of_tasksloop_i)
-
- IMSMQMessagePtr spQMsg("MSMQ.MSMQMessa
ge") - spQMsg-gtLabel g
- spQMsg-gtBody BSTR(paniniMessage)
- spQMsg-gtDelivery MQMSG_DELIVERY_RECOVERABLE
8sample.cpp(contd.)
void Wait_For_Output(char guids,int
number_of_guids,char output) ) IMSMQQueueInf
oPtr spQInfo1("MSMQ.MSMQQueueInfo") IMSMQMessag
ePtr spRMsg spRMsg spQRec-gtPeekCurrent(vtMiss
ing, vtMissing) while(1)
for(guid_i0guid_iltnumber_of_guidsguid_i)
if(_stricmp((char)spRMsg-gtLabel,guidsguid
_i)0) num_of_guids_matched
break if(guid_iltnumber_of_gui
ds) spRMsgspQRec-gtReceiveCurrent(vtMissin
g, vtMissing, vtMissing)
temp_strspRMsg-gtBody
while(altlength) outputguid_ia(char)tem
p_str.GetAt(a) if(num_of_guids_matched!numbe
r_of_guids) spRMsg spQRec-gtPeekCurrent(vt
Missing, vtMissing) else
spRMsgspQRec-gtPeekNext(vtMissing,
vtMissing)
9Including and using Panini output in user code
- //user_code.cpp
- includesample.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 output8
- char guids8
- Create_Queue() libdll_word_count_Fire(arr,4,gu
ids) Wait_For_Output(guids,4,output) - int no_words0
- for(int i0ilt7i)
- no_wordsatoi(outputi)
- coutltlt"Total number of words in all
files"ltltno_wordsltltendl - 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) - ...
-
10Keywords of Panini
- PANINI
- CREATE
- NODE
- LIBNAME
- FUNCTIONNAME
11Service running on all machines
- int Receive()
- /OPEN AND RECEIVE MESSAGE
BEGIN/ - IMSMQMessagePtr ReceiveMsg ReceiveQueuePtr-gtRe
ceive(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((HMOD
ULE)hLib, funcName_1) - FunctionPtr(input_to_function,
output_from_function) - /SEND MESSAGE BEGIN
/ - BSTR bstr_paniniMessageOut outMsg.AllocSysStri
ng() - ipaddr "DIRECTTCP" ipaddr
"\\PRIVATE\\listening_queue" - Send(bstr_FormatName, bstr_guid,
bstr_paniniMessageOut) - return 0
12Development tools and environment
- Visual Studio 2005
- Microsoft Message Queueing(MSMQ)
- Lex and Yacc
- Google Docs
13Test Plan
- Every grammar production was tested
- Testing communication between machines was a
major component of testing
14Conclusion
- 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