Saudi Arabia needs the initial public offering (IPO) of its state oil company to be successful as it needs to attract outside investment and, frankly, it needs the money, the former chief of the CIA David Petraeus told CNBC Thursday.

"It's a fact that Saudi Arabia is gradually running out of money, they'd be the first to acknowledge that the sovereign wealth fund has been reduced, it's somewhere below $500 billion now," Gen. David Petraeus, who is currently chair of the KKR Global Institute, told CNBC's Hadley Gamble in Abu Dhabi.

"The (budget) deficits each year, depending on the price of Brent crude, can be anywhere from $40 to $60 billion depending on some of their activities in countries in the region."

"The bottom line is that they need the money, they need that outside investment that is crucial to delivering 'Vision 2030' which cannot be realized without outside investment, this is just one component of a number of different initiatives that they're pursuing to try to attract that outside investment," he added.

Saudi Arabia is going to float a small portion of its state oil giant Saudi Aramco, the most profitable company in the world, in December. The IPO was first flagged in 2016 by the now-Crown Prince Mohammed bin Salman. He said then that he believed the company was worth around $2 trillion. The listing is seen as part of the crown prince's "Vision 2030" program of economic and social reforms designed to diversify the kingdom's economy and reduce its dependence on oil.

Saudi Arabia does not openly publish the amount of assets it holds within its sovereign wealth fund, known as the Public Investment Fund (PIF). The Institute of International Finance estimated in a report in June that the kingdom has assets worth around $300 billion with roughly a quarter of its holdings overseas. The Sovereign Wealth Fund Institute puts the figure closer to $320 billion. On its website, PIF says it "seeks to become one of the largest sovereign wealth funds in the world."

Saudi Arabia's economy is still largely reliant on oil exports, and lackluster oil prices (a barrel of Brent crude is currently priced at $63) have prompted the country's budget deficit (the amount by which its spending exceeds its revenues) to widen. In 2018, the budget deficit was forecast at around 136 billion riyals (or around $36 billion), according to the kingdom's Ministry of Finance. It's expected to be a similar amount in 2019. And in 2020, the kingdom expects the deficit to widen to $50 billion, the kingdom's finance minister said in October, according to Reuters.