-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
TODO | ||
## Benchmarking runtimes | ||
|
||
CPU runtimes using multiple threads. | ||
Wall clock runtimes for PLMC-DCA CPU-based sequence encoding (with PLMC parameter file) using multiple cores/threads. | ||
|
||
<p align="center"> | ||
<img src="../../.github/imgs/runtimes.png" alt="drawing" width="500"/> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
|
||
import os | ||
import sys | ||
import time | ||
import matplotlib.pyplot as plt | ||
|
||
pypef_path = os.path.abspath( | ||
os.path.join( | ||
os.path.dirname(__file__), | ||
'../..' | ||
) | ||
) | ||
|
||
sys.path.append(pypef_path) | ||
|
||
avgfp_path = os.path.abspath( | ||
os.path.join( | ||
os.path.dirname(__file__), | ||
'../../datasets/AVGFP' | ||
) | ||
) | ||
|
||
# Assuming that the Conda environment 'pypef' exists and contains all necessary Python packages, | ||
# using'avGFP_shortened.csv' instead of 'avGFP.csv' takes much less computing time | ||
cmd = f"conda run -n pypef python {os.path.join(pypef_path, 'pypef', 'main.py')} "\ | ||
f"encode -i {os.path.join(avgfp_path, 'avGFP.csv')} "\ | ||
f"-e dca -w {os.path.join(avgfp_path, 'P42212_F64L.fasta')} "\ | ||
f"--params {os.path.join(avgfp_path, 'uref100_avgfp_jhmmer_119_plmc_42.6.params')} "\ | ||
f"--threads XX" | ||
|
||
print(os.cpu_count()) | ||
all_run_times = [] | ||
for n_cores in range(1, os.cpu_count() + 1): | ||
run_time_1 = time.time() | ||
print(f"Running command:\n============\n{cmd.replace('XX', str(n_cores))}") | ||
os.system(cmd.replace('XX', str(n_cores))) | ||
run_time_2 = time.time() | ||
all_run_times.append(run_time_2 - run_time_1) | ||
plt.plot(range(1, os.cpu_count() + 1), all_run_times, 'o--') | ||
plt.grid() | ||
plt.xlabel('# Cores/Threads') | ||
plt.ylabel('Runtime (s)') | ||
plt.savefig(os.path.join(os.path.dirname(__file__), 'runtimes.png'), dpi=300) |