We develop numerical MHD model of gravitationally unstable cylindrical clouds. The model is implemented in numerical code FLASH. A series of test simulation runs for developed model were made, in which the initial ratios between the linear magnetic, thermal, and gravitational energies of the filament, as well as the wavelengths of the initial perturbations, were varied. We develop an algorithm for estimating gravitationaly bound clumps that were formed during fragmentation. The algorithm is based on determining the energy balance of clumps. The simulations show that the sizes of the ellipsoidal cores that are formed due to instability of small compressible longitudinal pertrurbations increase with it’s wavelength. The masses of the cores range from 0.3 to 3 M⊙. The sizes of the cores are limted by the radius of the filament so that small cores are born flattened along the filament axis, and large cores are elongated. In the case where instability is caused by external distrubances of the surface, the sizes of the cores depend weakly on the length of the disturbance. Differences in the characteristics of the cores in different model setups can determine the observed spectrum of masses of protostellar clouds.