-
Notifications
You must be signed in to change notification settings - Fork 7
Kronecker #79
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
Kronecker #79
Conversation
| Some _ -> resultBitmap.[0] <- newItem | ||
| _ -> () | ||
|
||
else if (gid - 1) < valuesLength then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif
| ClMatrix.CSR m1, ClMatrix.CSR m2 -> | ||
let result = run queue allocationFlag m1 m2 | ||
Option.map ClMatrix.COO result | ||
| _ -> failwith "Matrix formats are not matching" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide more information in the message to make it more useful?
let mutable res = 0 | ||
|
||
let xInt = | ||
match x with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to clarify why these conversions are needed?
Should it be reported as a quotation evaluator bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reported the issue.
fsprojects/FSharp.Quotations.Evaluator#45
@@ -73,7 +125,7 @@ module ArithmeticOperations = | |||
mkUnaryOp zero <@ fun x -> x + constant @> | |||
|
|||
let intSumOption = mkNumericSum 0 | |||
let byteSumOption = mkNumericSum 0uy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... Finally, what about bytes?
let create = create clContext workGroupSize | ||
|
||
let init = | ||
init <@ fun x -> x @> clContext workGroupSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be replaced with <@ id @>
?
@@ -53,6 +53,7 @@ | |||
<Compile Include="Backend/Matrix/Merge.fs" /> | |||
<Compile Include="Backend/Matrix/ExpandRows.fs" /> | |||
<Compile Include="Backend/Matrix/SubRows.fs" /> | |||
<Compile Include="Backend\Matrix\Kronecker.fs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path style
|
||
let createGeneralTest (context: ClContext) (processor: MailboxProcessor<Msg>) (zero: 'a) isEqual op opQ testName = | ||
|
||
let kronecker = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the pipeline not used here?
createGeneralTest context queue false (=) (&&) ArithmeticOperations.boolMulOption "mul" | ||
createGeneralTest context queue false (=) (||) ArithmeticOperations.boolSumOption "sum" | ||
|
||
createGeneralTest context queue 0 (=) (*) ArithmeticOperations.intMulOption "mul" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass the testContext
as a single parameter in order to reduce their number?
kroneckerFun processor ClContext.HostInterop m1 m2 | ||
|
||
let actual = | ||
Option.bind (fun (m: ClMatrix<'a>) -> m.ToHost processor |> Some) result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't Option.map
be used here?
|> Some) | ||
| None -> | ||
opOnHost value None | ||
|> Option.bind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option.map
?
let result = | ||
setPositions queue allocationMode values indices bitmap | ||
|
||
queue.Post(Msg.CreateFreeMsg<_>(indices)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClArray.Free
let result = | ||
setPositions queue allocationMode rows columns values bitmap | ||
|
||
queue.Post(Msg.CreateFreeMsg<_>(bitmap)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClArray.Free
let result = | ||
mapAll queue allocationMode size matrixZero matrixLeft matrixRight | ||
|
||
match matrixZero with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release only in one case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And mb Option.iter
?
let startIndex = | ||
insertNonZero queue rowsEdges matrixRight matrixLeft.Values leftColumns resultMatrix | ||
|
||
match matrixZero with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option.iter
?
Proposed Changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
Types of changes
What types of changes does your code introduce to GraphBLAS-sharp?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...