It's not possible.
I found it surprising how seriously his rather off the cuff, and joking, remark was taken, reported as a major news story by many journalists. For instance, the Independent reports Want to make Mars hospitable? Drop nuclear bombs, says Elon Musk and many other headlines of that nature. It was followed soon after by stories from more thoughtful reporters saying that it is impossible. e.g. Sorry, Elon Musk: One Does Not Simply Nuke Mars Into Habitability in the Huffington post. He later clarified his plans by saying he meant exploding a fusion bomb every few seconds over its poles to create a mini sun. A rather far future science fiction idea that's not practical today. Elon Musk Clarifies His Plan to "Nuke Mars"
First, nukes are nowhere near as powerful as a comet impact. A large comet would release about as much energy as 625,000 of the Tsar Bomba, at fifty megatons, the most powerful nuclear weapon ever tested.
A single large comet impact is equivalent in yield to around 625,000 of these - the most powerful nuclear weapon ever tested
Then, comet impacts also are not powerful enough either, as they haven't terraformed Mars yet.
\
Comet impacts haven't terraformed Mars
It is true that Mars can be pushed into a runaway greenhouse effect, where all the dry ice gets evaporated into the atmosphere.
However, to get to that point you need to have an atmosphere that is about 10% of the atmospheric pressure of the Earth at sea level. Mars current atmosphere is 1% so you need to somehow release nine times the current amount of CO2 in its atmosphere.
From this graph, Chris McKay, a leading planetary astrogeophysicist, deduces that to get Mars to go into a runaway greenhouse effect using just CO2, it needs about 100 millibars - or same pressure as 10% of Earth's atmosphere, to be released into the atmosphere.
It is not clear whether Mars has that much dry ice. There is enough to double its atmosphere. But to end up with ten times its current atmosphere is less certain.
If you don't release enough CO2, then it will revert to its current state because a denser atmosphere would be out of equilibrium with the vapour pressure of the dry ice at its poles, so it would all condense back to its poles as dry ice.
The amount of CO2 released by a single Tsar Bomba is tiny, even if you
dropped it directly on a known dry ice deposit at the poles. You would need billions of them to release enough to push it into a runaway greenhouse state.
It does seem to be possible using powerful greenhouse gases, which some think is the easiest way to do it. But this is still is a large scale project.
You'd need to mine over 11 cubic kilometers of fluorite ore on Mars. More than that if you have to use ores with lower concentrations of fluorine. It requires the output of over 200 nuclear power stations on Mars, working on creating these gases 24/7 for a century before you can push it into the new state.
And then, even a thick CO2 rich atmosphere on Mars is not enough to keep it warm enough to be habitable for much more than microbes and hardy lichens and such like.
After this runaway greenhouse, if you could get it to work, it would be warm enough for liquid water on Mars occasionally, but any standing water would turn to ice, chances are, and at any rate it's not likely to get hot enough for trees to grow.
You'd need constant resupply of greenhouse gases, or space mirrors or such like to keep it warm enough for habitability. And then it would take about a hundred thousand years of photosynthesis to get from that to an oxygen rich atmosphere.
Also, once you get an oxygen rich atmosphere, you then lose the warming effect of the CO2 (because oxygen and nitrogen are not greenhouse gases - water vapour is, but you don't have enough of that).
So, you would need to increase production of the greenhouse gases when the CO2 is converted to oxygen - or build more space mirrors to keep the planet warm or it would plunge back to its present cold state.
The natural average surface temperature of Mars, if you gave it an atmosphere like Earth, is around -50 °C. (By comparison, the same figure for Earth is 16 °C).
Fluorine based gases could be used to heat up the atmosphere enough, but it would take more than 11 cubic kilometers of this ore, or more if it has a lower proportion of fluorine, to make enough powerful greenhouse gases to warm up Mars enough, and require output of over 200 nuclear power stations for a hundred years.
There are many more issues with terraforming Mars, some of those issues are covered in detail in my Trouble with Terraforming Mars.
So, in short, it can't be done.
I wrote this up in more detail in my Why Nukes Can't Terraform Mars - Pack Less Punch Than A Comet Collision
(this summary comes from its introduction)
Also have written this up as an ebook: