In this paper, a dual-mode routing approach is proposed for routing messages in 2D photonic network on chip (NoC) platforms. The dual-mode routing approach is based on selecting exclusively one of two routing techniques for each stage of a parallel application. Depending on the data exchange requirements of a specific stage of an application, either a conventional per-message-based routing or a collective routing technique is selected, and the network on chip architecture is organized to support that selection. The network on chip architecture that we use is a two-dimensional torus topology built from novel non-blocking all-port photonic switches. The design of non-blocking all-port photonic switch empowers each node with simultaneous connections to four other nodes in the network. The rich connectivity provided by the switches helps the collective routing technique to efficiently support collective communication operations by allowing deadlock-free and contention-free dense data exchange among the nodes. Similar dense data exchanges are also required for some commonly known parallel algorithms such as parallel matrix multiplication, linear equation solvers and n-body simulation algorithms, just to name a few. A lightweight electronic network is employed for establishing and tearing down the photonic communication paths (light paths) in per-message-based routing technique. The lightweight electronic network is also used for coordinating the whole network in the collective routing technique.