def _load_override_file(): global _override_block_size_db, _override_block_size_compute_cap; fname = os.path.expanduser("~") + '/.hoomd_block_tuning'; # only load if the file exists if not os.path.isfile(fname): return # save the file f = open(fname, 'rb'); globals.msg.notice(2, 'Reading optimal block sizes from ' + str(fname) + '\n'); # read the version of the file ver = pickle.load(f); # handle the different file versions if ver == 0: # read and verify the version this was tuned on hoomd_version = pickle.load(f); if hoomd_version != hoomd.get_hoomd_version(): globals.msg.warning("~/.hoomd_block_tuning was created with" + str(hoomd_version) + \ ", but this is " + str(hoomd.get_hoomd_version()) + ". Reverting to default performance tuning.\n"); return; # read the compute capability of the GPU this was tuned on _override_block_size_compute_cap = pickle.load(f); # read the dictionary _override_block_size_db = pickle.load(f); else: globals.msg.error("Unknown ~/.hoomd_block_tuning format " + str(ver) + ".\n"); raise RuntimeError("Error loading .hoomd_block_tuning"); f.close();
def _save_override_file(common_optimal_db): fname = os.path.expanduser("~") + '/.hoomd_block_tuning' # see if the user really wants to overwrite the file if os.path.isfile(fname): globals.msg.warning( fname + " exists. This file is being overwritten with new settings\n") # save the file f = open(fname, 'wb') globals.msg.notice(2, 'Writing optimal block sizes to ' + str(fname) + '\n') # write the version of the file pickle.dump(0, f) # write out the version this was tuned on pickle.dump(hoomd.get_hoomd_version(), f) # write out the compute capability of the GPU this was tuned on pickle.dump( globals.system_definition.getParticleData().getExecConf(). getComputeCapability(), f) # write out the dictionary pickle.dump(common_optimal_db, f) f.close()
def _load_override_file(): global _override_block_size_db, _override_block_size_compute_cap fname = os.path.expanduser("~") + '/.hoomd_block_tuning' # only load if the file exists if not os.path.isfile(fname): return # save the file f = open(fname, 'rb') globals.msg.notice(2, 'Reading optimal block sizes from ' + str(fname) + '\n') # read the version of the file ver = pickle.load(f) # handle the different file versions if ver == 0: # read and verify the version this was tuned on hoomd_version = pickle.load(f) if hoomd_version != hoomd.get_hoomd_version(): globals.msg.warning("~/.hoomd_block_tuning was created with" + str(hoomd_version) + \ ", but this is " + str(hoomd.get_hoomd_version()) + ". Reverting to default performance tuning.\n") return # read the compute capability of the GPU this was tuned on _override_block_size_compute_cap = pickle.load(f) # read the dictionary _override_block_size_db = pickle.load(f) else: globals.msg.error("Unknown ~/.hoomd_block_tuning format " + str(ver) + ".\n") raise RuntimeError("Error loading .hoomd_block_tuning") f.close()
def _save_override_file(common_optimal_db): fname = os.path.expanduser("~") + '/.hoomd_block_tuning'; # see if the user really wants to overwrite the file if os.path.isfile(fname): globals.msg.warning(fname + " exists. This file is being overwritten with new settings\n"); # save the file f = open(fname, 'wb'); globals.msg.notice(2, 'Writing optimal block sizes to ' + str(fname) + '\n'); # write the version of the file pickle.dump(0, f); # write out the version this was tuned on pickle.dump(hoomd.get_hoomd_version(), f); # write out the compute capability of the GPU this was tuned on pickle.dump(globals.system_definition.getParticleData().getExecConf().getComputeCapability(), f); # write out the dictionary pickle.dump(common_optimal_db, f); f.close();