LOS ANGELES — “Dunkirk” and “Girls Trip” won big at the weekend box office by breaking unwritten Hollywood rules about release dates and cast diversity. But another flouter of film industry norms, the surreal, independently financed space adventure “Valerian and the City of a Thousand Planets,” was dead on arrival.

Powered by exceptional reviews — the word “masterpiece” was bandied about — “Dunkirk” (Warner Bros.) took in about $50.5 million at North American theaters, or about 20 percent more than analysts had expected before release. Turnout was very strong at Imax locations. (The film was shot with Imax 70-millimeter cameras.) “Dunkirk,” directed and written by Christopher Nolan and focused on trapped soldiers during World War II, collected an additional $55.4 million in partial release overseas.

“Dunkirk” cost about $100 million to make, not including marketing.

Releasing “Dunkirk” in late July was a risk. Serious films aimed at older audiences tend to arrive in the fall or late winter; summer is usually reserved for comic-book adaptations and science-fiction epics. But Mr. Nolan wanted a summer berth for “Dunkirk,” and Warner Bros. backed him, betting that audiences would be hungry for something smart and original after an unsatisfying diet of sequels to sequels.

“The right movie can play and play in late summer,” Jeff Goldstein, Warner’s president of domestic distribution, said by phone on Sunday. Mr. Goldstein cited “the Nolan pedigree” for stronger-than-expected turnout, along with “our marketing team, which did a phenomenal job.”