CUDA Python packing problem resolving with first fit algorithm