Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
00a2194
sample script for psc bridges2
lee212 Jun 6, 2021
3e5ff74
entk output sample
lee212 Jun 6, 2021
b25a821
conda cloning instruction
lee212 Jun 10, 2021
b1b629a
typo in access_schema
lee212 Jun 15, 2021
c3c4a07
latest updates applied
lee212 Jun 28, 2021
31a2ffe
num_tasks is 16 because of 2 bridges machines (8 v100 each)
lee212 Jun 28, 2021
ea9c2d8
test.txt
igory1999 May 22, 2022
aee18f8
Merge pull request #50 from DeepDriveMD/test1
braceal May 22, 2022
36a3300
using examples directory
braceal Jun 5, 2022
12f2b38
explicit logic instead of try-except
braceal Jun 5, 2022
901f1d0
Merge pull request #48 from DeepDriveMD/feature/psc_bridges2
braceal Jun 5, 2022
ed78236
update radical.entk resource_desc to use access_schema #49
braceal Jun 5, 2022
956436e
updating openmm API to 7.7 for file-based version and MD-ensemble exa…
braceal Jun 7, 2022
160379d
openmm changes
igory1999 Jun 14, 2022
6377443
removing test file
braceal Jun 14, 2022
fe6b965
updating openmm import API to v7.7
braceal Jun 14, 2022
1a719a6
debugging NaN particle coordinate
braceal Jun 14, 2022
18e13de
run1, run3m, run4m, run5m - success
igory1999 Jun 15, 2022
1ee4a87
insRec_OM_region_mini configuration
igory1999 Jun 18, 2022
991556f
edit all the generate scripts
igory1999 Jul 12, 2022
153b8f5
tmpdocs
igory1999 Jul 13, 2022
62864a8
powerai3.sh
igory1999 Jul 13, 2022
d8a295f
positions
igory1999 Jul 13, 2022
aa2e6b1
source script
igory1999 Jul 13, 2022
49c4be0
archive.sh
igory1999 Jul 13, 2022
55469f1
remove opencv fix
igory1999 Jul 13, 2022
38f12d0
How to use DeepDriveMD-S on lassen@LLNL with the existing installatio…
igory1999 Jul 16, 2022
946c7a0
install docs
igory1999 Jul 16, 2022
859c467
powerai.sh - setup environment
igory1999 Jul 16, 2022
19be0f2
fix powerai.sh link
igory1999 Jul 16, 2022
72fc650
fix/clean docs
braceal Jul 16, 2022
3cdabc2
remove commented code
braceal Jul 16, 2022
c427f71
remove commented code
igory1999 Jul 18, 2022
828be2e
some comments
igory1999 Jul 18, 2022
df67381
some comments 1
igory1999 Jul 19, 2022
aea089b
config from lassen
braceal Oct 25, 2022
6078573
Merge branch 'develop' of https://github.com/DeepDriveMD/DeepDriveMD-…
braceal Oct 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Radical EnTK
re.session*

conda-env/

# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks,visualstudiocode,visualstudio,pycharm,pycharm+all,pycharm+iml,pydev,macos,emacs,windows,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks,visualstudiocode,visualstudio,pycharm,pycharm+all,pycharm+iml,pydev,macos,emacs,windows,linux

Expand Down
78 changes: 78 additions & 0 deletions bin/powerai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
module load gcc/7.3.1
. /etc/profile.d/conda.sh
conda activate /usr/workspace/cv_ddmd/conda3/powerai

export IBM_POWERAI_LICENSE_ACCEPT=yes
module use /usr/workspace/cv_ddmd/software1/modules
module load adios2/2.8.1a

export WORKSPACE=/usr/workspace/$USER
export SHARED=/usr/workspace/cv_ddmd/$USER
export GPFS1=/p/gpfs1/$USER
export SB=$GPFS1/radical.pilot.sandbox

export MyDir=$1
export MyDir1=$GPFS1/DDMD/$MyDir/entk_cvae_md
export MyDir2=$MyDir1/analysis

export PYTHONPATH=$MyDir1/Outlier_search:$PYTHONPATH

export PATH=$HOME/bin:$HOME/spack/bin:$PATH

shopt -s direxpand

alias wks='cd $WORKSPACE'
alias gpfs='cd $GPFS1'

alias sb='cd $SB'
alias sb1='cd $SB/$(ls -d $MyDir1/re.* | xargs basename)/pilot.0000'

alias cd1='cd $MyDir1'
alias cd2='cd $MyDir2'
alias cd3='cd $SHARED'

alias bu='bkill -u $USER'

alias topU='top -U $USER'
alias bj='bjobs'
alias current='cd /g/g15/yakushin/tmp2/tmp/DeepDriveMD-pipeline/'
alias sim='cd /g/g15/yakushin/tmp2/tmp/DeepDriveMD-pipeline/deepdrivemd/sim/openmm_stream'
alias agg='cd /g/g15/yakushin/tmp2/tmp/DeepDriveMD-pipeline/deepdrivemd/aggregation/stream'
alias ml='cd /g/g15/yakushin/tmp2/tmp/DeepDriveMD-pipeline/deepdrivemd/models/keras_cvae_stream'
alias outliers='cd /g/g15/yakushin/tmp2/tmp/DeepDriveMD-pipeline/deepdrivemd/agents/stream'
alias outputs_ls='echo "/p/gpfs1/yakushin/Outputs"; ls -ltr /p/gpfs1/yakushin/Outputs'
alias outputs='cd /p/gpfs1/yakushin/Outputs'

function mcd1()
{
cd $GPFS1/DDMD/$1/entk_cvae_md
}

function mcd2()
{
cd $GPFS1/DDMD/$1/entk_cvae_md/analysis
}

function msb1()
{
cd $SB/$(ls -d $GPFS1/DDMD/$1/entk_cvae_md/re.* | xargs basename)/pilot.0000
}


function em
{
emacs -nw +$2:1 $1
}

function logs()
{
cd /p/gpfs1/yakushin/radical.pilot.sandbox
cd $(ls -tr | tail -1)
cd pilot*
}

function logs1()
{
cd /p/gpfs1/yakushin/radical.pilot.sandbox
cd $1/pilot*
}
12 changes: 0 additions & 12 deletions deepdrivemd/agents/stream/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ class OutlierDetectionConfig(AgentTaskConfig):
model: str = "cvae"
num_points: int = 539
num_features: int = 0
"""
encoder_bias: bool = True
encoder_relu_slope: float = 0.0
encoder_filters: List[int] = [64, 128, 256, 256, 512]
encoder_kernels: List[int] = [5, 5, 3, 1, 1]
decoder_bias: bool = True
decoder_relu_slope: float = 0.0
decoder_affine_widths: List[int] = [64, 128, 512, 1024]
discriminator_bias: bool = True
discriminator_relu_slope: float = 0.0
discriminator_affine_widths: List[int] = [512, 128, 64]
"""


if __name__ == "__main__":
Expand Down
122 changes: 14 additions & 108 deletions deepdrivemd/agents/stream/dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from mdlearn.nn.models.aae.point_3d_aae import AAE3d
from numba import cuda
from pathos.multiprocessing import ProcessingPool as Pool
from simtk.openmm.app.pdbfile import PDBFile
from openmm.app.pdbfile import PDBFile
from sklearn.neighbors import LocalOutlierFactor
from torchsummary import summary

Expand Down Expand Up @@ -116,9 +116,10 @@ def wait_for_model(cfg: OutlierDetectionConfig) -> str:
while True:
if os.path.exists(cfg.best_model):
break
print(f"No model {cfg.best_model}, sleeping")
sys.stdout.flush()
time.sleep(cfg.timeout2)
if(os.getenv('DDMD_DEBUG') == None):
print(f"No model {cfg.best_model}, sleeping")
sys.stdout.flush()
time.sleep(cfg.timeout2)
return cfg.best_model


Expand Down Expand Up @@ -251,7 +252,6 @@ def outliers_from_latent(
db_label = db.labels_.to_array()
print("unique labels = ", np.unique(db_label))
outlier_list = np.where(db_label == -1)
# clear_gpu()
return outlier_list


Expand Down Expand Up @@ -334,19 +334,8 @@ def write_pdb_frame(
)
sys.stdout.flush()

"""
import MDAnalysis as mda
with Timer("universe"):
mda_u = mda.Universe(str(original_pdb))
print(np.max(frame, axis=0) - np.min(frame, axis=0)); sys.stdout.flush()
mda_u.atoms.positions = frame

with Timer("write_pdb"):
mda_u.atoms.write(str(output_pdb_fn))
"""
np.save(str(output_pdb_fn), frame)


def write_pdb_frame_2(
frame: np.ndarray, original_pdb: Path, output_pdb_fn: str, ligand: int
):
Expand Down Expand Up @@ -611,15 +600,6 @@ def top_lof(
print(e)
outlier_list = list(filter(lambda x: x < len(cm_predict), outlier_list))
projections = cm_predict[outlier_list]
"""
print("type(projections)=", type(projections))
print("dir(projections)=", dir(projections))
print("projections=", projections)
projections = projections.cpu()
print("type(projections) = ", type(projections))
projections = projections.detach().numpy()
print("type(projections) = ", type(projections))
"""

lof_scores = run_lof(projections)
print("lof_scores = ", lof_scores)
Expand Down Expand Up @@ -715,7 +695,6 @@ def main(cfg: OutlierDetectionConfig):
adios_files_list = list(map(lambda x: x.replace(".sst", ""), adios_files_list))

variable_list = [
# StreamContactMapVariable("contact_map", np.uint8, DataStructure.array),
StreamVariable("positions", np.float32, DataStructure.array),
StreamVariable("md5", str, DataStructure.string),
StreamVariable("velocities", np.float32, DataStructure.array),
Expand Down Expand Up @@ -752,11 +731,13 @@ def main(cfg: OutlierDetectionConfig):
try:
agg_input = mystreams.next()
except: # noqa TODO: flake8 - should not have a bar except
print("Sleeping for input")
time.sleep(60)
if(os.getenv('DDMD_DEBUG') == None):
print("Sleeping for input")
time.sleep(60)
continue
if len(agg_input[list(agg_input.keys())[0]]) < 10:
time.sleep(30)
if(os.getenv('DDMD_DEBUG') == None):
time.sleep(30)
else:
break

Expand Down Expand Up @@ -785,7 +766,6 @@ def main(cfg: OutlierDetectionConfig):
or len(outlier_list[0]) < cfg.num_sim
):
print("Not using outliers")
# clear_gpu()
if cfg.compute_rmsd:
print("Using best rmsd states")
outlier_list = [select_best(cfg, agg_input)]
Expand Down Expand Up @@ -823,7 +803,8 @@ def main(cfg: OutlierDetectionConfig):
with Timer("outlier_publish"):
publish(tmp_dir, published_dir)

time.sleep(random.randint(250, 350))
if(os.getenv('DDMD_DEBUG') == None):
time.sleep(random.randint(250, 350))

with Timer("outlier_read"):
agg_input = mystreams.next()
Expand Down Expand Up @@ -915,17 +896,6 @@ def read_lastN( # noqa
variable_lists[vl] = np.vstack(variable_lists[vl])
print(len(variable_lists[vl]))

"""
variable_lists["contact_map"] = np.array(
list(
map(
lambda x: t1Dto2D(np.unpackbits(x.astype("uint8"))),
list(variable_lists["contact_map"]),
)
)
)
"""

if not variable_lists:
return {}

Expand Down Expand Up @@ -994,62 +964,6 @@ def project_mini(cfg: OutlierDetectionConfig, trajectory: str):
np.save(f, embeddings)


"""

def project_mini(cfg: OutlierDetectionConfig):
# with Timer("wait_for_input"):
# adios_files_list = wait_for_input(cfg)

ddd = os.path.dirname(cfg.agg_dir)

adios_files_list = glob.glob(
f"{ddd}/molecular_dynamics_runs/stage0000/task0*/*/trajectory.bp"
)

adios_files_list = glob.glob(f"{ddd}/aggregation_runs/stage0000/task0*/agg.bp")

with Timer("wait_for_model"):
model_path = str(wait_for_model(cfg))
print("model_path = ", model_path)

lastN = cfg.project_lastN

# Create output directories
dirs(cfg)

for i, bp in enumerate(adios_files_list):
print(f"i={i}, bp={bp}")
sys.stdout.flush()
agg_input = read_lastN([bp], lastN)

if hasattr(cfg, "compute_zcentroid") and cfg.compute_zcentroid:
zcentroid = agg_input["zcentroid"]
with open(cfg.output_path / f"zcentroid_{i}.npy", "wb") as f:
np.save(f, zcentroid)

if cfg.compute_rmsd:
rmsds = agg_input["rmsds"]
with open(cfg.output_path / f"rmsd_{i}.npy", "wb") as f:
np.save(f, rmsds)

if hasattr(cfg, "multi_ligand_table") and cfg.multi_ligand_table.is_file():
ligand = agg_input["ligand"]
sim = agg_input["dirs"]
for j in range(len(ligand)):
print(f"ligand[{j}] = {ligand[j]}")
if ligand[j] == -1:
ligand[j] = int(sim[j])
with open(cfg.output_path / f"ligand_{i}.npy", "wb") as f:
np.save(f, ligand)

with Timer("project_predict"):
embeddings_cvae = predict(cfg, model_path, agg_input, batch_size=64)
with open(cfg.output_path / f"embeddings_cvae_{i}.npy", "wb") as f:
np.save(f, embeddings_cvae)

"""


def project(cfg: OutlierDetectionConfig):
"""Postproduction: compute t-SNE embeddings."""
if cfg.project_gpu:
Expand Down Expand Up @@ -1120,26 +1034,18 @@ def project_tsne_2D(cfg: OutlierDetectionConfig):
tsne2 = TSNE(n_components=2)
emb = []
rmsds = []
# ligands = []
embs = glob.glob(str(cfg.output_path) + "/embeddings_cvae_*.npy")
for i in range(len(embs)):
with open(cfg.output_path / f"embeddings_cvae_{i}.npy", "rb") as f:
emb.append(np.load(f))
with open(cfg.output_path / f"rmsd_{i}.npy", "rb") as f:
rmsds.append(np.load(f))
"""
with open(cfg.output_path / f"ligand_{i}.npy", "rb") as f:
ligands.append(np.load(f))
"""

embeddings_cvae = np.concatenate(emb)
RMSDS = np.concatenate(rmsds)
with open(cfg.output_path / "rmsds.npy", "wb") as f:
np.save(f, RMSDS)
"""
LIGANDS = np.concatenate(ligands)
with open(cfg.output_path / "ligands.npy", "wb") as f:
np.save(f, LIGANDS)
"""

with Timer("project_TSNE_2D"):
tsne_embeddings2 = tsne2.fit_transform(embeddings_cvae)

Expand Down
11 changes: 0 additions & 11 deletions deepdrivemd/aggregation/stream/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,6 @@ def aggregate(
status = ARW.read_step(sim_task_id)
if status:
ARW.d_md5 = intarray2hash(ARW.d_md5)
"""
print("dir(ARW) = ", dir(ARW))
sys.stdout.flush()
print("contact_map.shape = ", ARW.d_contact_map.shape)
print("contact_map.dtype = ", ARW.d_contact_map.dtype)
print(ARW.d_contact_map)
print("positions.shape = ", ARW.d_positions.shape)
print("positions.dtype = ", ARW.d_positions.dtype)
sys.stdout.flush()
"""

ARW.write_step(aggregator_stream_4ml, variablesW_4ml, end_step=True)
ARW.write_step(aggregator_stream, variablesW, end_step=False)
aggregator_stream.write("dir", str(sim_task_id), end_step=True)
Expand Down
9 changes: 5 additions & 4 deletions deepdrivemd/data/stream/adios_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@


class AdiosStreamStepRW:
"""Read/Write step by step adios stream using Full API.
"""Read/Write step by step adios stream using Full API. Full API is needed not to block if some
adios stream does not have data yet: check the status of the adios stream, if the next simulation step
is not available there yet, go to the next stream and revisit the current stream later.
The status can only be checked in Full ADIOS API. High level API can only read in blocking or
non-blocking way.

Attributes
----------
Expand Down Expand Up @@ -65,13 +69,10 @@ def read_step(self, sim_task_id: int) -> bool:
if not (status == adios2.StepStatus.OK):
return False

# print(self.variables)

for v in self.variables:
vname = "var_" + v
dname = "d_" + v
dtype = self.variables[v][0]
# print("vname = ", vname); import sys; sys.stdout.flush()
structure_type = self.variables[v][1]
setattr(self, vname, io.InquireVariable(v))
if structure_type == DataStructure.scalar:
Expand Down
3 changes: 0 additions & 3 deletions deepdrivemd/data/stream/aggregator_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# from deepdrivemd.utils import t1Dto2D
from pathlib import Path
from typing import Dict, List, Union

Expand Down Expand Up @@ -62,8 +61,6 @@ class StreamContactMapVariable(StreamVariable):

def next(self, ARW):
var = getattr(ARW, "d_" + self.name)
# var = np.unpackbits(var)
# var = t1Dto2D(var)
self.total.append(var)


Expand Down
Loading