It is narrated from Sayyiduna Ali (may Allah be pleased with him) that he said: "I was a man who had a lot of madhi (pre-seminal fluid), and the Messenger of Allah (peace and blessings be upon him) said: 'When you see madhi, wash your private part and perform ablution as for prayer, and when you discharge semen, take a ritual bath (ghusl).'"
Imam Ahmad (may Allah have mercy on him) narrated it from Abd al-Rahman (may Allah have mercy on him) and others, from Za'idah (may Allah have mercy on him), from Rukayn (may Allah have mercy on him).