|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
PASCAL
DETAILS
Question: Is there a way to run my Pascal programs in parallel?
Answer: There is indeed, but it's not going to be easy. One way of "parallelizing" your programs is to include "message passing" in the code. Different portions of the code are thereby executed by different processors, and information is shared by passing messages between the processors. The most widely used method to do this is called Message Passing Interface (MPI), and is available in the form of libraries on the SUN Fire muti-processor machines of HPCVL. However, MPI works only with FORTRAN and C directly. The libraries consist of subroutines that can be called from code written in those two languages. In order to write parallel code in Pascal, you therefore have to do the following things.
* Write your code in a "single code multiple data" manner by inserting calls to message-passing functions. The interface with these functions will have to be designed by you. * Implement the message-passing functions in C and use the C-bindings of the MPI library inside of those functions. * Compile your Pascal routines with GPC, and your C-routines with the native C-compiler to produce object code. Include the proper header files in the C functions via the "-I" option. Collect the C-functions in a library using the ar command. * Link the object code with GPC, including the C-functions in the form of a library. MPI is linked in by specifying "-l", "-L", "-R", and "-I" options.
|
|
|
Category |
Pascal Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7012 users |
Added on |
10/22/2012 6:17:10 AM |
Views |
68406 |
Rate it! |
|
|
Question:
Is there a way to run my Pascal programs in parallel?
Answer:
There is indeed, but it's not going to be easy. One way of "parallelizing" your programs is to include "message passing" in the code. Different portions of the code are thereby executed by different processors, and information is shared by passing messages between the processors. The most widely used method to do this is called Message Passing Interface (MPI), and is available in the form of libraries on the SUN Fire muti-processor machines of HPCVL. However, MPI works only with FORTRAN and C directly. The libraries consist of subroutines that can be called from code written in those two languages. In order to write parallel code in Pascal, you therefore have to do the following things.
* Write your code in a "single code multiple data" manner by inserting calls to message-passing functions. The interface with these functions will have to be designed by you. * Implement the message-passing functions in C and use the C-bindings of the MPI library inside of those functions. * Compile your Pascal routines with GPC, and your C-routines with the native C-compiler to produce object code. Include the proper header files in the C functions via the "-I" option. Collect the C-functions in a library using the ar command. * Link the object code with GPC, including the C-functions in the form of a library. MPI is linked in by specifying "-l", "-L", "-R", and "-I" options. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Pascal Interview Questions & Answers - Exam Mode /
Learning Mode
|