@@ -111,7 +111,7 @@ class TfqSimulateExpectationOpCuda : public tensorflow::OpKernel {
111
111
for (const int num : num_qubits) {
112
112
max_num_qubits = std::max (max_num_qubits, num);
113
113
}
114
- if (max_num_qubits >= 26 || programs.size () == 1 || true ) {
114
+ if (max_num_qubits >= 26 || programs.size () == 1 ) {
115
115
ComputeLarge (num_qubits, fused_circuits, pauli_sums, context,
116
116
&output_tensor);
117
117
} else {
@@ -122,7 +122,6 @@ class TfqSimulateExpectationOpCuda : public tensorflow::OpKernel {
122
122
123
123
private:
124
124
int num_threads_in_sim_;
125
- int thread_per_block_;
126
125
int block_count_;
127
126
128
127
// Define the GPU implementation that launches the CUDA kernel.
@@ -135,24 +134,10 @@ class TfqSimulateExpectationOpCuda : public tensorflow::OpKernel {
135
134
// Instantiate qsim objects.
136
135
using Simulator = qsim::SimulatorCUDA<float >;
137
136
using StateSpace = Simulator::StateSpace;
138
- // Launch the cuda kernel. These parameters came from:
139
- // 1. min/max num_threads in //third_party/qsim/tests/simulator_cuda_test.cu
140
- // 2. min/max num_threads & dblocks in
141
- // //third_party/qsim/tests/statespace_cuda_test.cu
142
- // //third_party/qsim/lib/statespace_cuda.h:55-64
143
- // num_dblocks has no explanation. just follow test code 2 or 16.
144
- int block_count = 2 ; // 2 or 16;
145
- // num_threads = 2**q where q in [5..10]
146
- int thread_per_block = 128 ; // 32, 64, 128, 256, 512, 1024;
147
- // TFQ GPU
148
- StateSpace::Parameter param_ss;
149
- param_ss.num_threads = thread_per_block;
150
- param_ss.num_dblocks = block_count;
151
-
152
- // Begin simulation.
137
+ // Begin simulation with default parameters.
153
138
int largest_nq = 1 ;
154
139
Simulator sim = Simulator ();
155
- StateSpace ss = StateSpace (param_ss );
140
+ StateSpace ss = StateSpace (StateSpace::Parameter () );
156
141
auto sv = ss.Create (largest_nq);
157
142
auto scratch = ss.Create (largest_nq);
158
143
@@ -199,10 +184,7 @@ class TfqSimulateExpectationOpCuda : public tensorflow::OpKernel {
199
184
using Simulator = qsim::SimulatorCUDA<float >;
200
185
using StateSpace = Simulator::StateSpace;
201
186
202
- StateSpace::Parameter param_ss;
203
- param_ss.num_threads = thread_per_block_;
204
- param_ss.num_dblocks = block_count_;
205
-
187
+ StateSpace::Parameter param_default;
206
188
const int output_dim_op_size = output_tensor->dimension (1 );
207
189
208
190
Status compute_status = Status ();
@@ -215,7 +197,7 @@ class TfqSimulateExpectationOpCuda : public tensorflow::OpKernel {
215
197
216
198
// Begin simulation.
217
199
auto sim = Simulator ();
218
- auto ss = StateSpace (param_ss );
200
+ auto ss = StateSpace (param_default );
219
201
auto sv = ss.Create (largest_nq);
220
202
auto scratch = ss.Create (largest_nq);
221
203
for (int i = start; i < end; i++) {
0 commit comments