Exemplo n.º 1
0
    def write_command_file(self, icpu, f):

        input_file = self.config_yaml['args'].input_file
        inpdir_list = self.config_prep['inpdir_list']
        covsys_list2d = self.config_prep['covsys_list2d']
        wfitopt_list = self.config_prep['wfitopt_arg_list']
        n_core = self.config_prep['n_core']

        idir_list3 = self.config_prep['idir_list3']
        icov_list3 = self.config_prep['icov_list3']
        ifit_list3 = self.config_prep['ifit_list3']

        n_job_cpu = 0
        n_job_local = 0

        for idir, icov, ifit in zip(idir_list3, icov_list3, ifit_list3):

            n_job_local += 1
            index_dict = \
                { 'idir':idir, 'ifit':ifit, 'icov':icov, 'icpu':icpu }

            if ((n_job_local - 1) % n_core) != icpu: continue

            n_job_cpu += 1
            job_info_wfit = self.prep_JOB_INFO_wfit(index_dict)
            util.write_job_info(f, job_info_wfit, icpu)

            job_info_merge = self.prep_JOB_INFO_merge(icpu, n_job_local)
            util.write_jobmerge_info(f, job_info_merge, icpu)

        return n_job_cpu
Exemplo n.º 2
0
    def write_command_file(self, icpu, f):
        # For this icpu, write full set of sim commands to
        # already-opened command file with pointer f.
        # Function returns number of jobs for this cpu

        n_core = self.config_prep['n_core']
        n_trainopt = self.config_prep['n_trainopt']
        n_job_tot = n_trainopt
        n_job_split = 1  # cannot break up train job
        n_job_local = 0
        n_job_cpu = 0

        self.config_prep['n_job_split'] = n_job_split
        self.config_prep['n_job_tot'] = n_job_tot
        self.config_prep['n_done_tot'] = n_job_tot

        for itrain in range(0, n_trainopt):
            n_job_local += 1
            if ((n_job_local - 1) % n_core) == icpu:

                n_job_cpu += 1
                job_info_train = self.prep_JOB_INFO_train(itrain)
                util.write_job_info(f, job_info_train, icpu)

                job_info_merge = self.prep_JOB_INFO_merge(icpu, n_job_local)
                util.write_jobmerge_info(f, job_info_merge, icpu)

        return n_job_cpu
Exemplo n.º 3
0
    def write_command_file(self, icpu, f):

        # Called from base;
        # For this icpu, write full set of sim commands to
        # already-opened command file with pointer f.
        # Function returns number of jobs for this cpu

        n_core = self.config_prep['n_core']
        CONFIG = self.config_yaml['CONFIG']
        makeDataFiles_args_list = self.config_prep['makeDataFiles_args_list']

        n_job = self.config_prep['n_job']
        n_job_split = self.config_prep['n_job_split']
        n_job_tot = self.config_prep['n_job_tot']
        n_job_tot = self.config_prep['n_done_tot']
        idata_unit_list = self.config_prep['idata_unit_list']
        isplitran_list = self.config_prep['isplitran_list']
        n_job_local = 0
        n_job_cpu = 0

        index_dict = {}
        for idata_unit, isplitran in zip(idata_unit_list, isplitran_list):

            n_job_local += 1
            if ((n_job_local - 1) % n_core) == icpu:

                n_job_cpu += 1
                index_dict['isplitran'] = isplitran
                index_dict['icpu'] = icpu
                index_dict['idata_unit'] = idata_unit
                index_dict['n_job_local'] = n_job_local

                job_info_data_unit = self.prep_JOB_INFO_mkdata(index_dict)
                util.write_job_info(f, job_info_data_unit, icpu)

                job_info_merge = self.prep_JOB_INFO_merge(icpu, n_job_local)
                util.write_jobmerge_info(f, job_info_merge, icpu)

        #print(f" xxx n_core={n_core}   n_job_cpu = {n_job_cpu}  " \
        #      f" n_job_local = {n_job_local}")

        return n_job_cpu