I don't think there's anything wrong with leaving a marathon-length interview if you realize in the middle that neither party will benefit (personally, it would have to be very bad for me to leave in the middle because I always hope that the situation might turn around and something can be salvaged). HOW you make your exit is probably key and very important if you don't want such hostile reactions. It might be best to say something very polite such as:
Before we continue the next phase, I'd like to say thank-you for all of the time you've spent this morning. At this stage in the interview, I feel that it would not benefit either of us to continue the process.
Or something like that. If the interviewer reacts angrily, I think that is quite unprofessional of them. Would they prefer you to stay all day only to hear at 4 pm that you decided 5 hours ago that the whole exercise was pointless? I wouldn't like that if I were the interviewer.