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

Optimized Tensors #167

Merged
merged 17 commits into from
May 9, 2023
Merged

Optimized Tensors #167

merged 17 commits into from
May 9, 2023

Conversation

leondavi
Copy link
Owner

@leondavi leondavi commented Apr 23, 2023

@zivmo99

Hi Ziv,
Please implement encode_nif
Please review my implementation in both erl files and cpp especially
decode_nif, get_binary methods.

Thanks

Note: This should be merged only after the PR of onn600!

@leondavi
Copy link
Owner Author

@zivmo99
Please review my implementation and continue from that point.

@leondavi
Copy link
Owner Author

@dolby360
Is it possible to start the pipeline checks only by demand?

@leondavi leondavi force-pushed the nerlTensor branch 2 times, most recently from 13cdc4d to 3237bc7 Compare April 29, 2023 23:11
src_cpp/opennnBridge/openNNnif.h Outdated Show resolved Hide resolved
src_cpp/opennnBridge/openNNnif.h Outdated Show resolved Hide resolved
@leondavi leondavi force-pushed the nerlTensor branch 3 times, most recently from 547277c to d897ca1 Compare May 1, 2023 15:19
@leondavi
Copy link
Owner Author

leondavi commented May 1, 2023

@halfway258 please approve that this PR works fine.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@halfway258
This is the generic file that contains useful methods.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@halfway258 nerlTests .erl implementation


COMPILE_FILES="$COMPILE_NERL,$COMPILE_NERLNIF,$COMPILE_NERLTEST"

erl -noshell -eval "$COMPILE_FILES, nerlTests:run_tests()." -s init stop > "$NERLNET_TEST_DIR/$LOG_FILE"
Copy link
Owner Author

@leondavi leondavi May 1, 2023

Choose a reason for hiding this comment

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

@dolby360
Here is the calling to nerlTests module
If you want to get some kind of exception to see if action fails you just can change it as follows:
"$COMPILE_FILES, throw(check), nerlTests:run_tests()."

@leondavi leondavi force-pushed the nerlTensor branch 5 times, most recently from a2f74e6 to 894384f Compare May 7, 2023 05:57
}


template<typename BasicType> void get_tensor_data(ErlNifEnv *env , ERL_NIF_TERM bin_term, std::vector<BasicType> &data, std::vector<BasicType> &dims_orig, std::vector<int> &dims)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Should change to
get_tensor(ErlNifEnv *env , ERL_NIF_TERM bin_term, TensorTypePtr &tensor_ptr)
Rowmajor binary map to rowmajor tensor swap to colmajor tensor

make_tensor(ErlNifEnv *env , nifpp::TERM &out_bin_term, TensorTypePtr &tensor_ptr)
convert colmajor --> rowmajor --> binary

end.


tic() -> erlang:timestamp().
Copy link
Collaborator

Choose a reason for hiding this comment

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

erlang has a function that does this: {TimeTook, ReturnVal} = timer:tc(M, F, A)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point

@halfway258
Copy link
Collaborator

I ran the tests, all good

@leondavi
Copy link
Owner Author

leondavi commented May 8, 2023

I ran the tests, all good

Please run it again with my latest push (on raspberry pi as well) just to make sure and approve this PR

@halfway258
Copy link
Collaborator

Test on raspberry pi passed:
image

@leondavi leondavi requested a review from halfway258 May 9, 2023 14:51
@leondavi leondavi merged commit 8546321 into master May 9, 2023
1 check passed
@leondavi leondavi deleted the nerlTensor branch June 30, 2023 23:09
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.

None yet

2 participants