Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cqc-melf
Copy link
Contributor

No description provided.

@cqc-melf cqc-melf force-pushed the feature/more-wasm-examples branch from 648f341 to fde2418 Compare October 10, 2023 21:38
@cqc-melf cqc-melf force-pushed the feature/more-wasm-examples branch from fde2418 to f5e8653 Compare October 10, 2023 21:41
@cqc-melf cqc-melf marked this pull request as ready for review October 11, 2023 13:30
@cqc-melf cqc-melf requested a review from cqc-alec October 11, 2023 13:30

def get(self, key: QubitPauliString, default: CoeffType) -> CoeffType:
return self._dict.get(key, default)
return self._dict.get(key, default) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, not sure why this wasn't needed before. Maybe a mypy update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet sure if this solves the issue, I had not shown this locally.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry to be pedantic but could you change "unvalid" to "invalid" everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, done in baef46c

Ways to compile wasm from C/C++ are:

```
emcc <filename>.c -o <filename>.html
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this produce html? How do you get the wasm from that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This produces an html file and a wasm file, I have not found a way to use emcc to generate only the wasm file without the html if the file that is compiled contains additional libraries. I just deleted the html files after compiling.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

( I have pointed this out in the readme, see b07edfa )

.gitignore Outdated
pytket/tests/qasm_test_files/testout4.qasm
pytket/tests/qasm_test_files/testout5.qasm
pytket/tests/qasm_test_files/testout6.qasm
secret-file.wasm
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does this come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have some additional tests locally with files that should not be uploaded. I wanted to add this to make sure the file does not get added accidentally.

Copy link
Collaborator

@cqc-alec cqc-alec Oct 11, 2023

Choose a reason for hiding this comment

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

You can add it to .git/info/exclude locally instead of here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have clean up this up in 0c6137a

if not supported_function:
self._unsupported_function.append(x)

except:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wary of catching all errors, at least if we swallow up the error content like this -- it can easily mask bugs. Why don't we define a custom error type that we can throw from specific places in this code? Are there particular cases you're aware of where the checker fails but the code runs? Ideally this would not be the case but if there are I think it would be better to single them out rather than treat all errors this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The general idea if this was to avoid cryptic error messages when paring wasm files that are broken. I wanted to point out to the user that something has gone wrong and explain what the causes might have been. I am not aware of wasm files that can break the parsing and still can be run. I have removed this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in 71697f1

Copy link
Collaborator

Choose a reason for hiding this comment

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

This file probably shouldn't be here, as there is README.md?

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, remove the file in b9674e2

```

```
clang --target=wasm32 -mmultivalue -Xclang -target-abi -Xclang experimental-mv --no-standard-libraries -Wl,--export-all -Wl,--no-entry -o <filename>.wasm <filename>.c
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason not to always run this command, i.e. do we need to also give the version without multivalue support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This command is not working with older clang versions, I thought it might be nice to have both. If you thing we should remove this, I am happy to do that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't mind having both but should explain what the difference is and when one needs to use the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added some details to the readme in b07edfa

@cqc-melf cqc-melf requested a review from cqc-alec October 12, 2023 16:06
@cqc-melf cqc-melf merged commit 013df5e into develop Oct 13, 2023
@cqc-melf cqc-melf deleted the feature/more-wasm-examples branch October 13, 2023 07:53
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.

3 participants