We solve, for finite N , the matrix model of supersymmetric U(N ) ChernSimons theory coupled to N f massive hypermultiplets of R-charge 1 2 , together with a FayetIliopoulos term. We compute the partition function by identifying it with a determinant of a Hankel matrix, whose entries are parametric derivatives (of order N f − 1) of Mordell integrals. We obtain finite Gauss sums expressions for the partition functions. We also apply these results to obtain an exhaustive test of Giveon-Kutasov (GK) duality in the N = 3 setting, by systematic computation of the matrix models involved. The phase factor that arises in the duality is then obtained explicitly. We give an expression characterized by modular arithmetic (mod 4) behavior that holds for all tested values of the parameters (checked up to N f = 12 flavours).