How to get number of elements of associative array having 2 dimensional index?

In reply to Sagar Shah:

SystemVerilog does not really have multi-dimensional arrays; it only has one-dimensional arrays of arrays. So the num method only works on one dimension at a time.

What you want is

    $display("%0d num reached", comp_dev_id.sum(array) with (array.num()) );