GalIMF (Galaxy-wide Initial Mass Function) computes the galaxy-wide initial stellar mass function by integrating over a whole galaxy, parameterized by star formation rate and metallicity. The generated stellar mass distribution depends on the galaxy-wide star formation rate (SFR, which is related to the total mass of a galalxy) and the galaxy-wide metallicity. The code can generate a galaxy-wide IMF (IGIMF) and can also generate all the stellar masses within a galaxy with optimal sampling (OSGIMF). To compute the IGIMF or the OSGIMF, the GalIMF module contains all local IMF properties (e.g. the dependence of the stellar IMF on the metallicity, on the density of the star-cluster forming molecular cloud cores), and this software module can, therefore, be also used to obtain only the stellar IMF with various prescriptions, or to investigate other features of the stellar population such as what is the most massive star that can be formed in a star cluster.