blob: f1297b7e622b7d234bc83ebb4dd937258f7d4f8e [file] [log] [blame]
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------
D = rand(rows=6400, cols=784, min=0, max=20, seed=42)
bs = 32;
ep = 10;
iter_ep = ceil(nrow(D)/bs);
maxiter = ep * iter_ep;
beg = 1;
iter = 0;
i = 1;
while (iter < maxiter) {
end = beg + bs - 1;
if (end>nrow(D))
end = nrow(D);
X = D[beg:end,]
#reusable OP across epochs
X = scale(X, TRUE, TRUE);
#pollute cache with not reusable OPs
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
X = ((X + X) * i - X) / (i+1)
iter = iter + 1;
if (end == nrow(D))
beg = 1;
else
beg = end + 1;
i = i + 1;
}
R = X;
write(R, $1, format="text");