1. A method of compiling a program to be executed on a multicore processor, the method comprising: generating an initial solution by mapping a task to a source processing element (PE) and a destination PE, and selecting a first communication scheme for transmission of the task from the source PE to the destination PE; generating a new solution by changing the task mapping and selecting a second communication scheme, and determining whether to change the first communication scheme to the second communication scheme based on comparison of the new solution with the initial solution; approximately optimizing at least one of the task mapping and the first communication scheme included in the initial solution, and the task mapping and the second communication scheme included in the new solution; and scheduling task in the source PE and the destination PE, wherein the communication scheme is designated in a compiling process, and wherein the first communication scheme is a communication scheme that is based on a shared memory and the second communication scheme communication scheme that uses a scratch pad memory included in each of the source PE and the destination PE.