I have tried parallelization of different types of cells by putting them in one for loop and checking with the local variable i whether it has reached the cell count limit. And based upon that it is assigned gids.

Now when I use the below lines:
cvode=new CVode()
cvode.active(1)
cvode.use_daspk(1)
cvode.condition_order(2)

I don't know which secton of code is to blame given the combination of your (unknown to me) network model, the DAE solver, and condition order 2.
Could you please send me the hoc,mod,ses,py, etc, files in a zip file so I can observe the error. Send to michael dot hines at yale dot edu .
I'm guessing that your model does not require the DAE solver (only needed if extracellular or LinearMechanism is being used) so I'd like to know also if it works without the cvode.use_daspk.