使用mpi4py进行MPI收集和分散

时间:2018-09-12 01:29:51

标签: python-2.7 raspberry-pi mpi4py

我是并行编程的新手。谁能帮助我让此代码在集群上并行运行?

for mail_name in mails_in_dir:

    mail_msg = get_mail_from_file(mail_path + mail_name)

    spam_probability = classify(mail_msg, spam_training_set, 0.2)
    ham_probability = classify(mail_msg, ham_training_set, 0.8)

    if spam_probability > ham_probability:
        results[SPAM] += 1
    else:
        results[HAM] += 1

    total_files = results[SPAM] + results[HAM]
    spam_fraction = float(results[SPAM]) / total_files
    ham_fraction = 1 - spam_fraction

0 个答案:

没有答案