Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cusignal nodes for Greenflow. #141

Merged
merged 6 commits into from
Sep 26, 2021
Merged

Conversation

avolkov1
Copy link
Contributor

@avolkov1 avolkov1 commented Jul 3, 2021

Added convolution nodes and a convolution notebook example.
Work in progress.

I'm going to add more examples.

Refer to notebook:
https://github.com/avolkov1/gQuant/blob/cusignal_example/gQuant/plugins/cusignal_plugin/notebooks/convolution_examples.ipynb

The plugin can be found here:
https://github.com/avolkov1/gQuant/tree/cusignal_example/gQuant/plugins/cusignal_plugin/greenflow_cusignal_plugin

I am currently using the "greenflowrc" to register the plugin. Later I'll add a setup.py and register via "greenflow.plugin".

To run checkout my branch. Then set "greenflowrc" as follows:

[ModuleFiles]
my_node = %(MODULEPATH)s/my_node.py
greenflow_cusignal_plugin = %(MODULEPATH)s/greenflow_cusignal_plugin

Where my modulepath is a directory from which I symlinked to the plugins.

$ ll modules
greenflow_cusignal_plugin -> <repo>/gQuant/plugins/cusignal_plugin/greenflow_cusignal_plugin
my_node.py -> <repo>/gQuant/plugins/gquant_plugin/modules/my_node.py

I startup jupyter lab via:

MODULEPATH=<repo>/workspace/modules \
GREENFLOW_CONFIG=<repo>/workspace/greenflowrc \
  jupyter lab --ip=0.0.0.0 --ContentsManager.allow_hidden=True --no-browser

I added pydot plotting options to "TaskGraph.draw". You'll need to pip install -e greenflow.

* Added convolution nodes and a convolution notebook example.
* Add sdr example.
* Expose build option to taskgraph run method.
* Fix memory leak by avoiding non-visited nodes in flow method.
* Add setup.py to cusignal greenflow plugin for streamlined installation.
* Using TemplateNodeMixin for cusignal nodes.
@avolkov1 avolkov1 marked this pull request as ready for review September 20, 2021 23:32
Copy link
Collaborator

@yidong72 yidong72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few comments. Since this is a stand alone plugin, could you add a README file to describe how to install and use this plugin like other plugins?

# FIXME: This is inconsistent. Above for __contains__, __iter__, and
# __next__, the returned object is a Task instance. Here however
# the returned object is a Node instance.
if not self.__node_dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. We need to change the API in the future to something like

def get_node(self, key):

and put a warning message inside this function that it is deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. We can do this in the future.

@yidong72
Copy link
Collaborator

yidong72 commented Sep 22, 2021

In the portfolio_trade.gq.yaml file.

- conf: {}
  id: ''
  inputs:
    in1: cumulative_return.cum_return
    in2: sharpe_ratio.sharpe_out
  module: rapids_modules
  type: Output_Collector

Need to remove the module: rapids_modules line.

Similarly in the simple_trade_gq.yaml file, need to remove the same line.

- conf: {}
  id: ''
  inputs:
    in1: stock_selector.stock_name
    in2: lineplot.lineplot
    in3: barplot.barplot
    in4: sharpe_ratio.sharpe_out
    in5: cumulative_return.cum_return
    in6: stock_data.cudf_out
  module: rapids_modules
  type: Output_Collector

also in the tutorial_intro.gq.yaml and get_return_feature.gq.yaml files.

@yidong72
Copy link
Collaborator

unittest tests/unit/test_performance.py failed, need to fix it.

(base) quant@21dc6bc7dbe0:~/greenflow/plugins/gquant_plugin$ python -m unittest tests/unit/test_performance.py
EE
======================================================================
ERROR: test_ports_setup_performance (tests.unit.test_performance.TestPerformance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/quant/greenflow/plugins/gquant_plugin/tests/unit/test_performance.py", line 92, in test_ports_setup_performance
    stats.stats[key][0], self.ports_setup_ref[dict_key])
KeyError: 'ports_setup.output_collector_node.py'

======================================================================
ERROR: test_meta_setup_performance (tests.unit.test_performance.TestPerformance)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/quant/greenflow/plugins/gquant_plugin/tests/unit/test_performance.py", line 107, in test_meta_setup_performance
    stats.stats[key][0], self.meta_setup_ref[dict_key])
KeyError: 'meta_setup.output_collector_node.py'

----------------------------------------------------------------------
Ran 2 tests in 0.382s

@avolkov1
Copy link
Contributor Author

Thanks for the review. I fixed the unit test to account for output collector calls and added a README file.

@yidong72
Copy link
Collaborator

looks good. I will merge it.

@yidong72 yidong72 merged commit 95d8f56 into NVIDIA:develop Sep 26, 2021
@avolkov1 avolkov1 deleted the cusignal_example branch September 27, 2021 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants