I don't know why people read it as "Luke giving up:" That's not how it's communicated in the film. This one is made up by angry fans who wanted to see a super-powered Skywalker in the film.
We know that Luke believed he failed Kylo Ren as his master, which led to his Jedi order being destroyed. Then, as we learned in TFA, he went looking for the First Jedi Temple.
If he really wanted to just "give up" on the Jedi after the Kylo incident, why would he painstakingly look for the super-secret ancient birthplace of the order he has now fully rejected? He wouldn't. He'd have retired to Old Ben's hut on Tatooine.
When you give up on something, when you are pushed too far, you lose the will to continue making an effort. You don't double down and try and accomplish the unachievable.
Luke went looking for answers after Kylo Ren's turn. He started to see a pattern of the chosen one's fall from grace, and wanted to see what could be done to keep the Force in balance and prevent this kind of pain from ever happening again. What he learned was what the viewers know from watching Episodes 1-6: that the Jedi, as they had developed into a bureaucratic council that was more concerned about protecting their power than the galaxy's citizens, were an unworthy torch-bearer of the light side of the Force. As the last of the Jedi, Luke wants that flame to extinguish so it can rise anew from a worthier source. That's why he disconnected himself from the Force: so he could not be found, and the Jedi teachings could be lost forever with the temple on that island.
I don't read this as Luke "losing hope" either. He knew there was darkness within him. He didn't want to create another Kylo Ren. I believe he truly was trying to save the galaxy from being stuck in a never-ending cycle of dogmatic war between the Jedi and Sith. Obviously, Luke learns throughout Episode 8 that the Jedi can be reborn in name, but evolve in discipline. The theme of this movie isn't "let the past die" like many people conclude - hell, since when does the audience agree with the bad guy's worldview and read it as the theme? - it's that failure is a great teacher, and that we collectively learn and can be made better by learning from the mistakes of others. Luke comes to realize that his failure, and the failure of the Jedi, can be valuable and inspire the emergence of a more worthy beacon of light.