I watched a movie few years ago about a man who was dying. He was attempting to upload his consciousnesses to a computer. And when his wife succeeded, some guys came to destroy him, but she managed to save him. He asked her to connect him to the internet, and he spread to every computer, and used them like RAM. At the end I remember some people were trying to kill him but ended up destroying every computer on the planet with a virus.
This is Trancendence.
Starring Johnny Depp as a scientist who uploads his consciousness into a computer to prevent his death (with the help of his wife). AI Johnny then escapes to the internet and builds his own world with reprogrammed machines etc, which getting exponentially more powerful, drawing opposition from the government etc. It ends with a virus wiping out almost all technology, but hints at a few nanomachine bits of computer Johnny surviving in a puddle under what is supposed to be a faraday cage in his garden.