N=1 G2 SYM theory and Compactification to Three Dimensions