initial commit

This commit is contained in:
Rajshekar K K 2020-07-04 12:04:37 +05:30
commit 0dc2657e88
324 changed files with 738090 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
**/bin
**/obj-pin
**/obj-comm
/.classpath
/.cproject
/.project
/.settings
**/hs_err*
**/*.swp

0
CHANGELOG Executable file
View File

202
LICENSE Executable file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

32
MAINTAINERS Executable file
View File

@ -0,0 +1,32 @@
3. 2. 1. The maintainers is a copy of the way that the Linux kernel maintainers works.
Example copy from SESC (Would be different for Tejas. Changes would be updated soon.)
-------------------------------------------------------------------------------------------
Please follow the following steps before sending a path/update:
1-Checkout the latest SESC version and synchronize your patch with it.
2-Try to verify that your patch/update works.
3-If a patch involves more than one maintainer send it to both of them
simulatenously.
4-Follow the coding guideline of the documentation.
D: Description
F: Files Maintained (Use regular expression to do a match)
P: Person
M: Mail patches to
W: Web-page
S: Status, one of the following:
Supported: Someone is actually paid to look after this.
Maintained: Someone actually looks after it.
Odd Fixes: It has a maintainer but they don't have time to do
much other than throw the odd patch in. See below..
Orphan: No current maintainer [but maybe you could take the
role as you write your new code].

30
NOTICE Executable file
View File

@ -0,0 +1,30 @@
/*****************************************************************************
Tejas Simulator
------------------------------------------------------------------------------
Copyright [2010] [Indian Institute of Technology, Delhi]
Licensed 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.
-------------------------------------------------------------------------------
Contributors: <name>
------------------------ NOTICE for Apache Common Pool ------------------------
Apache Commons Pool
Copyright 2001-2012 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
*****************************************************************************/

103
README Executable file
View File

@ -0,0 +1,103 @@
Operating System Verified on:
1. Ubuntu 14.04
2. Ubuntu 16.04
3. Ubuntu 18.04
HOW TO setup Tejas
-----------------------
Building
---------
how to setup the simulator for the first time.
Pre-requisite:
1. Download Intel PIN. Tested for version 3.7 Kit: 97619
https://software.intel.com/en-us/articles/pin-a-binary-instrumentation-tool-downloads
2. Java version: openjdk8
3. make
4. ant
5. g++
Commands to build:
--------------
Make changes to (set absolute path as per your machine) :
src/simulator/config/config.xml
src/emulator/pin/makefile_linux_mac
Run:
ant make-jar
If everything goes well, this will create a jars folder with tejas.jar in it.
Testing
----------
cd scripts
./test.sh
# Examples of configure parameters:
modifying and testing the simulator
-----------------------------------
testing
-------
committing
---------
ChangeLog
---------
Tejas directory structure
------------------------------
doc - contains explanation of the functionality and working of
source code with suitable examples
LICENSE - Contains the terms and conditions for use, reproduction and distribution
MAINTAINERS - who is responsible for what description
NOTICE - copyright notice
README - Contains instructions to build and provides overview of Tejas
src - all real code for Tejas is in this directory (description below)
TODO - if you have some time available and you want to have some fun,
check this file and help improve Tejas
src directory structure
-----------------------
configure - configuration script
emulator - source files of the emulator (Implemented in C++)
simulator - source files of the simulator (Implemented in Java)
/src/simulator/ :
generic - functionalities used across packages
for example : event queue is used by memory-system and pipeline
misc - miscellaneous functions
memory - cache simulator
pipeline - pipeline simulation
config - used to set various configuration parameters such as underlying architecture,
number of cores, and branch-predictor
power - power modelling of the system using performance counters
net - simulate the on-chip network to estimate the delay due to bus-contention
emulatorinterface - interface to the emulator
/src/simulator/emulatorinterface :
translator - translates the assembly-format of the executable to abstract instruction
translator/x86 - x86 translator
translator/mips - mips translator
translator/arm - arm translator
communication - used to take the value from the emulator
communication/shm - shared memory
communication/pipe - pipe
communication/network - network
communication/socket - sockets
instruction - abstract format of the instruction

8
ROADMAP Executable file
View File

@ -0,0 +1,8 @@
Version 0.1:
+ NUCA (To be done by Mayur)
+ Some Testing (Rajshekar)
+ Reuse thread ids (Eldhose and Harsh)
+ Pipeline Bugs (Eldhose and Mayur)
Version 0.2:
+ Qemu Packet and Pin Packet (Prathmesh and Nitin)

12
TODO Executable file
View File

@ -0,0 +1,12 @@
1)
_______________________________________________________________________________
2)
_______________________________________________________________________________
3)
_______________________________________________________________________________
4)
_______________________________________________________________________________

1
VERSION Executable file
View File

@ -0,0 +1 @@
0.2

1
benchmarks/parsec Executable file
View File

@ -0,0 +1 @@
ADD

1
benchmarks/speccpu2006 Executable file
View File

@ -0,0 +1 @@
add

1
benchmarks/splash Executable file
View File

@ -0,0 +1 @@
ADD

81
build.xml Executable file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="Tejas">
<!-- change these as required -->
<property name="jar-dir" value="jars"/> <!-- directory where the jars are generated -->
<property name="jar-name" value="tejas"/> <!-- name of the jar -->
<property name="main-class" value="main.Main"/> <!-- path to the main class -->
<!-- ________________________ -->
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Tejas.classpath">
<pathelement location="bin"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
<exclude name="simulator/"/>
<exclude name="emulator/pin/"/>
</fileset>
</copy>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src/simulator">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src/emulator/pin">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean" depends="clean-pin">
<delete dir="bin"/>
<delete dir="jars"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project,build-pin" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="src"/>
<exclude name="simulator/"/>
<exclude name="emulator/pin/"/>
<classpath refid="Tejas.classpath"/>
</javac>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="src/simulator"/>
<classpath refid="Tejas.classpath"/>
</javac>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="src/emulator/pin"/>
<classpath refid="Tejas.classpath"/>
</javac>
</target>
<target name="clean-pin">
<exec dir="src/emulator/pin" executable="make">
<arg value="clean"/>
</exec>
</target>
<target name="build-pin">
<exec dir="src/emulator/pin" executable="make">
</exec>
</target>
<target name="make-jar" depends="build">
<mkdir dir="${jar-dir}"/>
<jar destfile="${jar-dir}/${jar-name}.jar" basedir="bin">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
</project>

98
install.py Normal file
View File

@ -0,0 +1,98 @@
from sys import platform
import subprocess
import xml.etree.ElementTree as ET
import os, sys
import shutil
# TEJAS_HOME = "/home/sandeep/Desktop/Work/PhD/Tejas"
# PIN_HOME = "/home/sandeep/Desktop/Test/pin-3.7-97619-g0d0c92f4f-gcc-linux/"
print (("\n\nStep 1 : Reading Config files"))
fname = 'bin/config/config.xml'
tree = ET.parse(fname)
root = tree.getroot()
emulator = root.find('Emulator')
TEJAS_HOME=emulator.find('Tejashome').text
PIN_HOME=emulator.find('PinTool').text
#PIN
print (("\n\nStep 2 : setting up Pin"))
print ("Building Pin")
subprocess.call(['./tejaspin.sh', TEJAS_HOME, PIN_HOME])
print ("Building PIN done")
#configuring
print ('\n\nStep 3 : Configuring')
jniInclude=""
fname=""
jniInclude = "-I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -I/usr/lib/jvm/java-8-openjdk-amd64/include "
fname = 'src/emulator/pin/makefile_linux_mac'
print ('setting PINPATH in ' + fname + " to " + PIN_HOME)
f = open(fname, 'r')
lines = f.readlines()
i = 0
for line in lines:
if "PIN_KIT ?=" in line:
lines[i] = "PIN_KIT ?=" + PIN_HOME + "\n"
if "JNINCLUDE =" in line:
lines[i] = "JNINCLUDE =" + jniInclude + "\n"
i = i + 1
f.close()
f = open(fname, 'w')
for line in lines:
f.write(line)
f.close()
#update config.xml
fname = 'src/simulator/config/config.xml'
tree = ET.parse(fname)
root = tree.getroot()
emulator = root.find('Emulator')
print ('setting PinTool in ' + fname + ' to ' + PIN_HOME)
emulator.find('PinTool').text = PIN_HOME
print ('setting PinInstrumentor in ' + fname + ' to ' + TEJAS_HOME + '/src/emulator/pin/obj-pin/causalityTool.so')
emulator.find('PinInstrumentor').text = TEJAS_HOME + "/src/emulator/pin/obj-pin/causalityTool.so"
print ('setting ShmLibDirectory in ' + fname + ' to ' + TEJAS_HOME + '/src/emulator/pin/obj-comm')
emulator.find('ShmLibDirectory').text = TEJAS_HOME + "/src/emulator/pin/obj-comm"
print ('setting KillEmulatorScript in ' + fname + ' to ' + TEJAS_HOME + '/src/simulator/main/killAllDescendents.sh')
emulator.find('KillEmulatorScript').text = TEJAS_HOME + "/src/simulator/main/killAllDescendents.sh"
system = root.find('System')
noc = system.find('NOC')
print ('setting NocConfigFile in ' + fname + ' to ' + TEJAS_HOME + '/src/simulator/config/NocConfig.txt')
noc.find('NocConfigFile').text = TEJAS_HOME + '/src/simulator/config/NocConfig.txt'
if sys.version_info < (2, 7):
tree.write(fname, encoding="UTF-8")
else:
tree.write(fname, encoding="UTF-8", xml_declaration=True)
print ("configure successful")
#building
print ('\n\nStep 4 : Building Jar File')
print ("jniInclude is " + jniInclude)
status = subprocess.call('ant make-jar',shell=True)
if status != 0 or os.path.exists(TEJAS_HOME + "/src/emulator/pin/obj-pin/causalityTool.so") == False or os.path.exists(TEJAS_HOME + "/src/emulator/pin/obj-comm/libshmlib.so") == False:
print ("error building : " + str(os.WEXITSTATUS(status)))
# print (output)
sys.exit(1)
else:
print ("build successful")
print ("------------- Tejas installed successfuly ----------------\n" )
print ("Tejas jar has been created here : " + TEJAS_HOME + "/jars/tejas.jar")
print ("Configuration file is kept here : " + TEJAS_HOME + "/src/simulator/config/config.xml")
print ("Use this command to run tejas : java -jar <tejas.jar> <config-file> <output-file> <input-program and arguments>")

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counter claim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

4
scripts/get_pin_latest.sh Executable file
View File

@ -0,0 +1,4 @@
wget https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.7-97619-g0d0c92f4f-gcc-linux.tar.gz
tar -xzvf pin-3.7-97619-g0d0c92f4f-gcc-linux.tar.gz
cd pin-3.7-97619-g0d0c92f4f-gcc-linux
pwd

311
scripts/install.py Normal file
View File

@ -0,0 +1,311 @@
from sys import platform
import commands
import xml.etree.ElementTree as ET
import os, sys
import shutil
if platform == "win32":
from subprocess import check_output,call
pwd = os.getcwd(); ###change
#elif platform == "linux" or platform == "linux2":
else:
pwd = commands.getoutput('pwd')
#print "\npwd is " + pwd
if os.path.exists(pwd + "/Tejas-Simulator") == False:
os.mkdir(pwd + "/Tejas-Simulator")
os.chdir(pwd + "/Tejas-Simulator")
pwd = pwd + "/Tejas-Simulator"
#print dependencies
print "\nInstallation Dependencies :"
print "\t1) Mercurial"
print "\t2) Java (tested for 1.6 and 1.7)"
print "\t3) ant"
print "\t4) Intel Pin tar-ball"
installation_option=raw_input("\n\nPress enter to continue. ")
# Install from tar-ball or repository
print "\n\nStep 1 : cloning Tejas source"
print "\n\nTejas Installation Option : "
print "\t1) to install Tejas from the tar-ball in installation kit"
print "\t2) to install Tejas from the repository (Latest version)"
installation_option=raw_input("\n\nenter option : ")
if installation_option=="1":
tejas_tar_ball=raw_input("\n\nenter path of tejas tar-ball : ")
if platform == "win32":
cmd="tar -xvf "+tejas_tar_ball+" --force-local"
status = call(cmd,shell=True)
#else platform == "linux" or platform == "linux2":
else:
status = os.system("tar -xvf " + tejas_tar_ball)
if status!=0:
print "error in extracting tejas : " + + str(os.WEXITSTATUS(status))
print '\n'
sys.exit(1)
else:
print "extracted tejas successfully"
elif installation_option=="2":
if platform == "linux" or platform == "linux2":
print "\n\n\tEnter guest as username and guest1 as password on prompt"
#clone tejas
url = "http://www.cse.iitd.ac.in/srishtihg/hg/distrib/Tejas"
if os.path.exists(pwd + '/Tejas'):
print "Tejas source already cloned"
else:
print 'getting source please wait'
status = os.system("hg clone " + url)
#status, output = commands.getstatusoutput("hg clone " + url)
if status != 0:
print "error cloning : " + str(os.WEXITSTATUS(status))
#print output
print '\n'
sys.exit(1)
else:
print "cloning successful"
else:
print "Invalid option for installation : " + installation_option
sys.exit(1)
#PIN
print "\n\nStep 2 : setting up Pin"
pin_path = ""
#download PIN
if platform == "win32":
#download PIN
print "Download version 71313-msvc11-windows from Intel's website : http://software.intel.com/en-us/articles/pintool-downloads"
print "Please read the license before downloading : http://software.intel.com/sites/landingpage/pintool/extlicense.txt"
print "NOTE : This installation script requires Pin in the form of zip file"
pin_tar_path = raw_input("\n\nenter absolute path of the Pin zip: ")
if os.path.exists(pin_tar_path) == False:
print "Pin not provided.. Exiting."
sys.exit(1)
#extract PIN
print "extracting PIN"
if os.path.exists(pwd + "/PIN"):
shutil.rmtree(pwd + "/PIN")
os.mkdir(pwd + "/PIN")
os.chdir(pwd + "/PIN")
status = call("jar xf " + pin_tar_path,shell=True)
if status != 0:
print "error extracting Pin"
print output
sys.exit(1)
filenames = os.listdir(pwd + "/PIN")
pin_path = pwd + "/PIN/" + filenames[0]
os.chdir(pwd)
else:
#if platform == "linux" or platform == "linux2":
#download PIN
print "Download version 62732 from Intel's website : http://software.intel.com/en-us/articles/pintool-downloads"
print "Please read the license before downloading : http://software.intel.com/sites/landingpage/pintool/extlicense.txt"
print "NOTE : This installation script requires Pin in the form of a tar-ball"
pin_tar_path = raw_input("\n\nenter absolute path of the Pin tar-ball (only tar.gz format) : ")
if os.path.exists(pin_tar_path) == False:
print "Pin not provided.. Exiting."
sys.exit(1)
#extract PIN
print "extracting PIN"
if os.path.exists(pwd + "/PIN"):
shutil.rmtree(pwd + "/PIN")
os.mkdir(pwd + "/PIN")
os.chdir(pwd + "/PIN")
status, output = commands.getstatusoutput("tar -xvf " + pin_tar_path)
if status != 0:
print "error extracting Pin : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
filenames = os.listdir(pwd + "/PIN")
pin_path = pwd + "/PIN/" + filenames[0]
os.chdir(pwd)
#configuring
print '\n\nStep 3 : Configuring'
jniInclude=""
fname=""
if platform == "win32":
jniInclude = "-I\"" + os.getenv('JAVA_HOME') + "\\include\" " + "-I\"" + os.getenv('JAVA_HOME') + "\\include\\win32\""
fname = 'Tejas/src/emulator/pin/makefile_windows'
else:
if platform == "darwin":
jniInclude = "-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
else:
jniInclude = "-I/usr/lib/jvm/java-6-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-9-openjdk-amd64/include -I/usr/lib/jvm/java-6-openjdk-i386/include -I/usr/lib/jvm/java-7-openjdk-i386/include -I/usr/lib/jvm/java-8-openjdk-i386/include -I/usr/lib/jvm/java-9-openjdk-i386/include "
fname = 'Tejas/src/emulator/pin/makefile_linux_mac'
print 'setting PINPATH in ' + fname + " to " + pin_path
f = open(fname, 'r')
lines = f.readlines()
i = 0
for line in lines:
if "PIN_KIT ?=" in line:
lines[i] = "PIN_KIT ?=" + pin_path + "\n"
if "JNINCLUDE =" in line:
lines[i] = "JNINCLUDE =" + jniInclude + "\n"
i = i + 1
f.close()
f = open(fname, 'w')
for line in lines:
f.write(line)
f.close()
#update config.xml
fname = 'Tejas/src/simulator/config/config.xml'
tree = ET.parse(fname)
root = tree.getroot()
emulator = root.find('Emulator')
if platform == "win32":
print 'setting PinTool in ' + fname + ' to ' + pin_path
emulator.find('PinTool').text = pin_path
print 'setting PinInstrumentor in ' + fname + ' to ' + pwd + '\Tejas\src\emulator\pin\obj-pin\causalityTool.dll'
emulator.find('PinInstrumentor').text = pwd + "\Tejas\src\emulator\pin\obj-pin\causalityTool.dll"
print 'setting ShmLibDirectory in ' + fname + ' to ' + pwd + '\Tejas\src\emulator\pin\obj-comm'
emulator.find('ShmLibDirectory').text = pwd + "\Tejas\src\emulator\pin\obj-comm"
print 'setting KillEmulatorScript in ' + fname + ' to ' + pwd + '\Tejas\src\simulator\main\killAllDescendents.bat'
emulator.find('KillEmulatorScript').text = pwd + "\Tejas\src\simulator\main\killAllDescendents.bat"
else:
#if platform == "linux" or platform == "linux2":
print 'setting PinTool in ' + fname + ' to ' + pin_path
emulator.find('PinTool').text = pin_path
print 'setting PinInstrumentor in ' + fname + ' to ' + pwd + '/Tejas/src/emulator/pin/obj-pin/causalityTool.so'
emulator.find('PinInstrumentor').text = pwd + "/Tejas/src/emulator/pin/obj-pin/causalityTool.so"
print 'setting ShmLibDirectory in ' + fname + ' to ' + pwd + '/Tejas/src/emulator/pin/obj-comm'
emulator.find('ShmLibDirectory').text = pwd + "/Tejas/src/emulator/pin/obj-comm"
print 'setting KillEmulatorScript in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/main/killAllDescendents.sh'
emulator.find('KillEmulatorScript').text = pwd + "/Tejas/src/simulator/main/killAllDescendents.sh"
system = root.find('System')
noc = system.find('NOC')
print 'setting NocConfigFile in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/config/NocConfig.txt'
noc.find('NocConfigFile').text = pwd + '/Tejas/src/simulator/config/NocConfig.txt'
#Change NOC config path
#l2=root.find('L2')
#print 'setting NocConfigFile in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/config/NocConfig.txt'
#l2.find('NocConfigFile').text = pwd + "/Tejas/src/simulator/config/NocConfig.txt"
if sys.version_info < (2, 7):
tree.write(fname, encoding="UTF-8")
else:
tree.write(fname, encoding="UTF-8", xml_declaration=True)
print "configure successful"
#building
print '\n\nStep 4 : Building'
os.chdir('Tejas')
if platform == "win32":
pwd = os.getcwd();
print "pwd is " + pwd
status = call("ant make-jar",shell=True)
if status != 0 or os.path.exists(pwd + "/src/emulator/pin/obj-pin/causalityTool.dll") == False or os.path.exists(pwd + "/src/emulator/pin/obj-comm/libshmlib.dll") == False:
print "error building : "
sys.exit(1)
else:
print "build successful"
else:
#if platform == "linux" or platform == "linux2":
pwd = commands.getoutput('pwd')
print "pwd is " + pwd
status, output = commands.getstatusoutput("ant make-jar")
if status != 0 or os.path.exists(pwd + "/src/emulator/pin/obj-pin/causalityTool.so") == False or os.path.exists(pwd + "/src/emulator/pin/obj-comm/libshmlib.so") == False:
print "error building : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
else:
print "build successful"
#test-run : hello world
if platform == "win32":
print '\n\nStep 5 : Test Run - Hello World'
os.chdir('..')
pwd=os.getcwd();
if os.path.exists(pwd + '/outputs')==False:
os.mkdir('outputs')
if os.path.exists(pwd + '/tests')==False:
os.mkdir('tests')
if os.path.exists(pwd + '/tests/hello_world.cpp')==False:
f = open(pwd + '/tests/hello_world.cpp', 'w')
f.write("#include<iostream>\nint main() {\nstd::cout<<\"hello world\"<<std::endl;\nreturn (0);\n}\n")
f.close()
cmd = "cl " + pwd + "/tests/hello_world.cpp "
os.chdir("tests");
print cmd
status = call(cmd,shell=True)
if status != 0 or os.path.exists(pwd + "/tests/hello_world.exe") == False:
print "error compiling test file "
sys.exit(1)
os.chdir('..')
cmd = "java -jar Tejas/jars/tejas.jar Tejas/src/simulator/config/config.xml outputs/hello_world.output tests/hello_world.exe"
print cmd
status = os.system(cmd)
if status != 0 or os.path.exists(pwd + "/outputs/hello_world.output") == False:
print "error running test "
sys.exit(1)
else:
#if platform == "linux" or platform == "linux2":
print '\n\nStep 5 : Test Run - Hello World'
os.chdir('..')
pwd=commands.getoutput('pwd')
if os.path.exists(pwd + '/outputs')==False:
os.mkdir('outputs')
if os.path.exists(pwd + '/tests')==False:
os.mkdir('tests')
if os.path.exists(pwd + '/tests/hello_world.cpp')==False:
f = open(pwd + '/tests/hello_world.cpp', 'w')
f.write("#include<iostream>\nint main() {\nstd::cout<<\"hello world\"<<std::endl;\nreturn (0);\n}\n")
f.close()
cmd = "g++ " + pwd + "/tests/hello_world.cpp -o " + pwd + "/tests/hello_world.o"
print cmd
status, output = commands.getstatusoutput(cmd)
if status != 0 or os.path.exists(pwd + "/tests/hello_world.o") == False:
print "error compiling test file : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
cmd = "java -jar " + pwd + "/Tejas/jars/tejas.jar " + pwd + "/Tejas/src/simulator/config/config.xml " + pwd + "/outputs/hello_world.output " + pwd + "/tests/hello_world.o"
print cmd
status = os.system(cmd)
if status != 0 or os.path.exists(pwd + "/outputs/hello_world.output") == False:
print "error running test : " + str(os.WEXITSTATUS(status))
sys.exit(1)
print "Helloworld test completed \n\n\n"
print "------------- Tejas installed successfuly ----------------\n"
print "Tejas jar has been created here : " + pwd + "/Tejas/jars/tejas.jar"
print "Configuration file is kept here : " + pwd + "/Tejas/src/simulator/config/config.xml"
print "Use this command to run tejas : java -jar <tejas.jar> <config-file> <output-file> <input-program and arguments>"

82
scripts/parallel_bm.sh Executable file
View File

@ -0,0 +1,82 @@
#Parallel Benchmark Suite. Contains parsec, splash, parboil, custom-benchmarks
if [ "$#" -ne 4 ]; then
echo "Illegal parameters"
echo "Usage bash parallel_bm.sh jarfile configfile statsdir outputsdir"
exit
fi
jarfile=$1
configfile=$2
statsdir=$3
outputsdir=$4
parsecdir="/mnt/srishtistr0/home/eldhose/PARSEC/parsec-2.1-core"
splash2dir="/local_scratch/mayur/jitter-code/splash2"
parboildir="/mnt/srishtistr0/home/eldhose/parboil"
custombmdir=
echo "Please don't use forward slash at the end of directory path"
echo "processing fmm"
java -Xmx1g -jar $jarfile $configfile $statsdir/fmm $splash2dir/codes/apps/fmm/FMM > $outputsdir/fmm 2>&1
echo "processing fft"
java -Xmx1g -jar $jarfile $configfile $statsdir/fft $splash2dir/codes/kernels/fft/FFT -p32 -m24 > $outputsdir/fft 2>&1
echo "processing lu_contiguous"
java -Xmx1g -jar $jarfile $configfile $statsdir/lu_contiguous $splash2dir/codes/kernels/lu/contiguous_blocks/LU -n4096 -p32 -b8 > $outputsdir/lu_contiguous 2>&1
echo "processing radiosity"
java -Xmx1g -jar $jarfile $configfile $statsdir/radiosity $splash2dir/codes/apps/radiosity/RADIOSITY -p 32 -batch -largeroom > $outputsdir/radiosity 2>&1
echo "processing blackscholes"
java -Xmx1g -jar $jarfile $configfile $statsdir/blackscholes $parsecdir/pkgs/apps/blackscholes/inst/amd64-linux.gcc-hooks/bin/blackscholes 32 $parsecdir/pkgs/apps/blackscholes/run/in_64K.txt /mnt/srishtistr0/home/eldhose/parsec-2.1-core/pkgs/apps/blackscholes/run/prices.txt > $outputsdir/blackscholes 2>&1
echo "processing fluidanimate"
java -Xmx1g -jar $jarfile $configfile $statsdir/fluid $parsecdir/pkgs/apps/fluidanimate/inst/amd64-linux.gcc-hooks/bin/fluidanimate 32 5 $parsecdir/pkgs/apps/fluidanimate/run/in_300K.fluid $parsecdir/pkgs/apps/fluidanimate/run/out.fluid > $outputsdir/fluidanimate 2>&1
echo "processing swaptions"
java -Xmx1g -jar $jarfile $configfile $statsdir/swaptions $parsecdir/pkgs/apps/swaptions/inst/amd64-linux.gcc-hooks/bin/swaptions -ns 64 -sm 20000 -nt 32 > $outputsdir/swaptions 2>&1
echo "processing streamcluster"
java -Xmx1g -jar $jarfile $configfile $statsdir/stream $parsecdir/pkgs/kernels/streamcluster/inst/amd64-linux.gcc-hooks/bin/streamcluster 10 20 128 16384 16384 1000 none $parsecdir/pkgs/kernels/streamcluster/run/output.txt 32 > $outputsdir/streamcluster 2>&1
echo "processing bodytrack"
#java -Xmx1g -jar $jarfile $configfile $statsdir/bodytrack $parsecdir/pkgs/apps/bodytrack/inst/amd64-linux.gcc-hooks/bin/bodytrack $parsecdir/pkgs/apps/bodytrack/run/sequenceB_4 4 4 4000 5 0 32 > $outputsdir/bodytrack 2>&1
echo "processing freqmine"
#java -Xmx1g -jar $jarfile $configfile $statsdir/freqmine $parsecdir/pkgs/apps/freqmine/inst/amd64-linux.gcc-hooks/bin/freqmine $parsecdir/pkgs/apps/freqmine/run/kosarak_250k.dat 790freqmine > $outputsdir/freqmine 2>&1
echo "processing vips"
#java -Xmx1g -jar $jarfile $configfile $statsdir/vips $parsecdir/pkgs/apps/vips/inst/amd64-linux.gcc-hooks/bin/vips im_benchmark $parsecdir/pkgs/apps/vips/run/bigben_2662x5500.v $parsecdir/pkgs/apps/vips/run/output.v > $outputsdir/vips 2>&1
echo "processing histo"
java -Xmx1g -jar $jarfile $configfile $statsdir/histo $parboildir/benchmarks/histo/build/omp_base_default/histo -i $parboildir/datasets/histo/default/input/img.bin -o $parboildir/benchmarks/histo/run/default/ref.bmp -- 20 4 > $outputsdir/histo 2>&1
echo "processing stencil"
java -Xmx1g -jar $jarfile $configfile $statsdir/stencil $parboildir/benchmarks/stencil/build/omp_base_default/stencil -i $parboildir/datasets/stencil/small/input/128x128x32.bin -o $parboildir/benchmarks/stencil/run/small/128x128x32.out -- 128 128 32 100 > $outputsdir/stencil 2>&1
echo "processing radix"
#java -Xmx1g -jar $jarfile $configfile $statsdir/radix $splash2dir/codes/kernels/radix/RADIX -p32 -n7666996 -r4 -m524288 > $outputsdir/radix 2>&1
#echo "processing "
#java -Xmx1g -jar $jarfile > $outputsdir/ 2>&1
echo "OVER!!!"

78
scripts/run_tejasdram Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
echo "Script for running Tejas dram benchmarks!"
#read arguments
if [ "$1" == "" ]; then
echo "Usage: run_tejasdram -r rank -b bank -policy Open/Close -bench benchmark"
exit 1
fi
while [ "$1" != "" ]; do
case $1 in
-c | --chan ) shift
chan=$1
;;
-r | --rank ) shift
rank=$1
;;
-b | --bank ) shift
bank=$1
;;
-policy ) shift
rowbuff=$1
;;
-bench ) shift
bench=$1
;;
* ) echo "Usage: script -r rank -b bank -policy Open/Close -bench benchmark"
exit 1
esac
shift
done
#rank=1
#bank=8
#rowbuff="Open"
#bench="429.mcf"
bench_name=`echo $bench | sed 's/.*\.//g' `
echo "Running bench : "$bench"_50M/$bench_name"
sed -i "s/<rowBufferPolicy>.*Page<\/rowBufferPolicy>/<rowBufferPolicy>"$rowbuff"Page<\/rowBufferPolicy>/g" ../src/simulator/config/config.xml
sed -i "s/<numChans>[0-9]*<\/numChans>/<numChans>"$chan"<\/numChans>/g" ../src/simulator/config/config.xml
sed -i "s/<numRanks>[0-9]*<\/numRanks>/<numRanks>"$rank"<\/numRanks>/g" ../src/simulator/config/config.xml
sed -i "s/<numBanks>[0-9]*<\/numBanks>/<numBanks>"$bank"<\/numBanks>/g" ../src/simulator/config/config.xml
#sed -i "s/\/mnt\/srishtistr0\/home\/harveen\/benchmarks\/dram_traces\/k6_.*.trc/\/mnt\/srishtistr0\/home\/harveen\/benchmarks\/dram_traces\/k6_"$bench"_"$rank"R_"$bank"B_"$rowbuff".trc/g" /mnt/srishtistr0/home/harveen/Tejas-RAM-try/Tejas-dram/../src/simulator/main/Main.java
#sed -i "s/\/mnt\/srishtistr0\/home\/harveen\/benchmarks\/timing\/.*.timing/\/mnt\/srishtistr0\/home\/harveen\/benchmarks\/timing\/"$bench"_"$rank"R_"$bank"B_"$rowbuff".timing/g" /mnt/srishtistr0/home/harveen/Tejas-RAM-try/Tejas-dram/../src/simulator/main/Main.java
#echo "Compiling!!"
#ant make-jar
echo -n "Running Tejas dram"
java -jar ../jars/tejas.jar ../src/simulator/config/config.xml /home/hk/Harveen/Work/DRAMSim/benchmarks/outputs/kips/tejas_dram/"$bench"_"$rank"R_"$bank"B_"$rowbuff".output /home/hk/Harveen/Work/DRAMSim/benchmarks/cpu2006/"$bench"_50M/"$bench_name"
#calculate average
#awk '{sum += ($2 - $1) ;n++} END {print sum/n,n}' /mnt/srishtistr0/home/harveen/benchmarks/timing/"$bench"_"$rank"R_"$bank"B_"$rowbuff".timing
#average_time=`awk '{sum += ($2 - $1) ;n++} END {print sum/n}' /mnt/srishtistr0/home/harveen/benchmarks/timing/"$bench"_"$rank"R_"$bank"B_"$rowbuff".timing`
#echo "Average is $average_time"
#rounded=`printf '%.*f' 0 $average_time`
#echo "Rounded to $rounded"
#latency=`expr $rounded + 20`;
#sed -i "s/<MainMemoryLatency>[0-9]*<\/MainMemoryLatency>/<MainMemoryLatency>"$latency"<\/MainMemoryLatency>/g" ~/Harveen/Work/DRAMSim/repo/Tejas-Simulator/Tejas/../src/simulator/config/config.xml
#cd /mnt/srishtistr0/home/harveen/repo/Tejas-Simulator/Tejas
echo "Running Tejas Sim"
java -jar /home/hk/Harveen/Work/DRAMSim/repo/Tejas-Simulator/Tejas/jars/tejas.jar /home/hk/Harveen/Work/DRAMSim/repo/Tejas-Simulator/Tejas/src/simulator/config/config.xml /home/hk/Harveen/Work/DRAMSim/benchmarks/outputs/kips/tejas_sim/"$bench"_"$rank"R_"$bank"B_"$rowbuff".output /home/hk/Harveen/Work/DRAMSim/benchmarks/cpu2006/"$bench"_50M/"$bench_name"

311
scripts/sc Normal file
View File

@ -0,0 +1,311 @@
from sys import platform
import commands
import xml.etree.ElementTree as ET
import os, sys
import shutil
if platform == "win32":
from subprocess import check_output,call
pwd = os.getcwd(); ###change
#elif platform == "linux" or platform == "linux2":
else:
pwd = commands.getoutput('pwd')
#print "\npwd is " + pwd
if os.path.exists(pwd + "/Tejas-Simulator") == False:
os.mkdir(pwd + "/Tejas-Simulator")
os.chdir(pwd + "/Tejas-Simulator")
pwd = pwd + "/Tejas-Simulator"
#print dependencies
print "\nInstallation Dependencies :"
print "\t1) Mercurial"
print "\t2) Java (tested for 1.6 and 1.7)"
print "\t3) ant"
print "\t4) Intel Pin tar-ball"
installation_option=raw_input("\n\nPress enter to continue. ")
# Install from tar-ball or repository
print "\n\nStep 1 : cloning Tejas source"
print "\n\nTejas Installation Option : "
print "\t1) to install Tejas from the tar-ball in installation kit"
print "\t2) to install Tejas from the repository (Latest version)"
installation_option=raw_input("\n\nenter option : ")
if installation_option=="1":
tejas_tar_ball=raw_input("\n\nenter path of tejas tar-ball : ")
if platform == "win32":
cmd="tar -xvf "+tejas_tar_ball+" --force-local"
status = call(cmd,shell=True)
#else platform == "linux" or platform == "linux2":
else:
status = os.system("tar -xvf " + tejas_tar_ball)
if status!=0:
print "error in extracting tejas : " + + str(os.WEXITSTATUS(status))
print '\n'
sys.exit(1)
else:
print "extracted tejas successfully"
elif installation_option=="2":
if platform == "linux" or platform == "linux2":
print "\n\n\tEnter guest as username and guest1 as password on prompt"
#clone tejas
url = "http://www.cse.iitd.ac.in/srishtihg/hg/distrib/Tejas"
if os.path.exists(pwd + '/Tejas'):
print "Tejas source already cloned"
else:
print 'getting source please wait'
status = os.system("hg clone " + url)
#status, output = commands.getstatusoutput("hg clone " + url)
if status != 0:
print "error cloning : " + str(os.WEXITSTATUS(status))
#print output
print '\n'
sys.exit(1)
else:
print "cloning successful"
else:
print "Invalid option for installation : " + installation_option
sys.exit(1)
#PIN
print "\n\nStep 2 : setting up Pin"
pin_path = ""
#download PIN
if platform == "win32":
#download PIN
print "Download version 71313-msvc11-windows from Intel's website : http://software.intel.com/en-us/articles/pintool-downloads"
print "Please read the license before downloading : http://software.intel.com/sites/landingpage/pintool/extlicense.txt"
print "NOTE : This installation script requires Pin in the form of zip file"
pin_tar_path = raw_input("\n\nenter absolute path of the Pin zip: ")
if os.path.exists(pin_tar_path) == False:
print "Pin not provided.. Exiting."
sys.exit(1)
#extract PIN
print "extracting PIN"
if os.path.exists(pwd + "/PIN"):
shutil.rmtree(pwd + "/PIN")
os.mkdir(pwd + "/PIN")
os.chdir(pwd + "/PIN")
status = call("jar xf " + pin_tar_path,shell=True)
if status != 0:
print "error extracting Pin"
print output
sys.exit(1)
filenames = os.listdir(pwd + "/PIN")
pin_path = pwd + "/PIN/" + filenames[0]
os.chdir(pwd)
else:
#if platform == "linux" or platform == "linux2":
#download PIN
print "Download version 62732 from Intel's website : http://software.intel.com/en-us/articles/pintool-downloads"
print "Please read the license before downloading : http://software.intel.com/sites/landingpage/pintool/extlicense.txt"
print "NOTE : This installation script requires Pin in the form of a tar-ball"
pin_tar_path = raw_input("\n\nenter absolute path of the Pin tar-ball (only tar.gz format) : ")
if os.path.exists(pin_tar_path) == False:
print "Pin not provided.. Exiting."
sys.exit(1)
#extract PIN
print "extracting PIN"
if os.path.exists(pwd + "/PIN"):
shutil.rmtree(pwd + "/PIN")
os.mkdir(pwd + "/PIN")
os.chdir(pwd + "/PIN")
status, output = commands.getstatusoutput("tar -xvf " + pin_tar_path)
if status != 0:
print "error extracting Pin : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
filenames = os.listdir(pwd + "/PIN")
pin_path = pwd + "/PIN/" + filenames[0]
os.chdir(pwd)
#configuring
print '\n\nStep 3 : Configuring'
jniInclude=""
fname=""
if platform == "win32":
jniInclude = "-I\"" + os.getenv('JAVA_HOME') + "\\include\" " + "-I\"" + os.getenv('JAVA_HOME') + "\\include\\win32\""
fname = 'Tejas/src/emulator/pin/makefile_windows'
else:
if platform == "darwin":
jniInclude = "-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
else:
jniInclude = "-I/usr/lib/jvm/java-6-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-9-openjdk-amd64/include -I/usr/lib/jvm/java-6-openjdk-i386/include -I/usr/lib/jvm/java-7-openjdk-i386/include -I/usr/lib/jvm/java-8-openjdk-i386/include -I/usr/lib/jvm/java-9-openjdk-i386/include "
fname = 'Tejas/src/emulator/pin/makefile_linux_mac'
print 'setting PINPATH in ' + fname + " to " + pin_path
f = open(fname, 'r')
lines = f.readlines()
i = 0
for line in lines:
if "PIN_KIT ?=" in line:
lines[i] = "PIN_KIT ?=" + pin_path + "\n"
if "JNINCLUDE =" in line:
lines[i] = "JNINCLUDE =" + jniInclude + "\n"
i = i + 1
f.close()
f = open(fname, 'w')
for line in lines:
f.write(line)
f.close()
#update config.xml
fname = 'Tejas/src/simulator/config/config.xml'
tree = ET.parse(fname)
root = tree.getroot()
emulator = root.find('Emulator')
if platform == "win32":
print 'setting PinTool in ' + fname + ' to ' + pin_path
emulator.find('PinTool').text = pin_path
print 'setting PinInstrumentor in ' + fname + ' to ' + pwd + '\Tejas\src\emulator\pin\obj-pin\causalityTool.dll'
emulator.find('PinInstrumentor').text = pwd + "\Tejas\src\emulator\pin\obj-pin\causalityTool.dll"
print 'setting ShmLibDirectory in ' + fname + ' to ' + pwd + '\Tejas\src\emulator\pin\obj-comm'
emulator.find('ShmLibDirectory').text = pwd + "\Tejas\src\emulator\pin\obj-comm"
print 'setting KillEmulatorScript in ' + fname + ' to ' + pwd + '\Tejas\src\simulator\main\killAllDescendents.bat'
emulator.find('KillEmulatorScript').text = pwd + "\Tejas\src\simulator\main\killAllDescendents.bat"
else:
#if platform == "linux" or platform == "linux2":
print 'setting PinTool in ' + fname + ' to ' + pin_path
emulator.find('PinTool').text = pin_path
print 'setting PinInstrumentor in ' + fname + ' to ' + pwd + '/Tejas/src/emulator/pin/obj-pin/causalityTool.so'
emulator.find('PinInstrumentor').text = pwd + "/Tejas/src/emulator/pin/obj-pin/causalityTool.so"
print 'setting ShmLibDirectory in ' + fname + ' to ' + pwd + '/Tejas/src/emulator/pin/obj-comm'
emulator.find('ShmLibDirectory').text = pwd + "/Tejas/src/emulator/pin/obj-comm"
print 'setting KillEmulatorScript in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/main/killAllDescendents.sh'
emulator.find('KillEmulatorScript').text = pwd + "/Tejas/src/simulator/main/killAllDescendents.sh"
system = root.find('System')
noc = system.find('NOC')
print 'setting NocConfigFile in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/config/NocConfig.txt'
noc.find('NocConfigFile').text = pwd + '/Tejas/src/simulator/config/NocConfig.txt'
#Change NOC config path
#l2=root.find('L2')
#print 'setting NocConfigFile in ' + fname + ' to ' + pwd + '/Tejas/src/simulator/config/NocConfig.txt'
#l2.find('NocConfigFile').text = pwd + "/Tejas/src/simulator/config/NocConfig.txt"
if sys.version_info < (2, 7):
tree.write(fname, encoding="UTF-8")
else:
tree.write(fname, encoding="UTF-8", xml_declaration=True)
print "configure successful"
#building
print '\n\nStep 4 : Building'
os.chdir('Tejas')
if platform == "win32":
pwd = os.getcwd();
print "pwd is " + pwd
status = call("ant make-jar",shell=True)
if status != 0 or os.path.exists(pwd + "/src/emulator/pin/obj-pin/causalityTool.dll") == False or os.path.exists(pwd + "/src/emulator/pin/obj-comm/libshmlib.dll") == False:
print "error building : "
sys.exit(1)
else:
print "build successful"
else:
#if platform == "linux" or platform == "linux2":
pwd = commands.getoutput('pwd')
print "pwd is " + pwd
status, output = commands.getstatusoutput("ant make-jar")
if status != 0 or os.path.exists(pwd + "/src/emulator/pin/obj-pin/causalityTool.so") == False or os.path.exists(pwd + "/src/emulator/pin/obj-comm/libshmlib.so") == False:
print "error building : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
else:
print "build successful"
#test-run : hello world
if platform == "win32":
print '\n\nStep 5 : Test Run - Hello World'
os.chdir('..')
pwd=os.getcwd();
if os.path.exists(pwd + '/outputs')==False:
os.mkdir('outputs')
if os.path.exists(pwd + '/tests')==False:
os.mkdir('tests')
if os.path.exists(pwd + '/tests/hello_world.cpp')==False:
f = open(pwd + '/tests/hello_world.cpp', 'w')
f.write("#include<iostream>\nint main() {\nstd::cout<<\"hello world\"<<std::endl;\nreturn (0);\n}\n")
f.close()
cmd = "cl " + pwd + "/tests/hello_world.cpp "
os.chdir("tests");
print cmd
status = call(cmd,shell=True)
if status != 0 or os.path.exists(pwd + "/tests/hello_world.exe") == False:
print "error compiling test file "
sys.exit(1)
os.chdir('..')
cmd = "java -jar Tejas/jars/tejas.jar Tejas/src/simulator/config/config.xml outputs/hello_world.output tests/hello_world.exe"
print cmd
status = os.system(cmd)
if status != 0 or os.path.exists(pwd + "/outputs/hello_world.output") == False:
print "error running test "
sys.exit(1)
else:
#if platform == "linux" or platform == "linux2":
print '\n\nStep 5 : Test Run - Hello World'
os.chdir('..')
pwd=commands.getoutput('pwd')
if os.path.exists(pwd + '/outputs')==False:
os.mkdir('outputs')
if os.path.exists(pwd + '/tests')==False:
os.mkdir('tests')
if os.path.exists(pwd + '/tests/hello_world.cpp')==False:
f = open(pwd + '/tests/hello_world.cpp', 'w')
f.write("#include<iostream>\nint main() {\nstd::cout<<\"hello world\"<<std::endl;\nreturn (0);\n}\n")
f.close()
cmd = "g++ " + pwd + "/tests/hello_world.cpp -o " + pwd + "/tests/hello_world.o"
print cmd
status, output = commands.getstatusoutput(cmd)
if status != 0 or os.path.exists(pwd + "/tests/hello_world.o") == False:
print "error compiling test file : " + str(os.WEXITSTATUS(status))
print output
sys.exit(1)
cmd = "java -jar " + pwd + "/Tejas/jars/tejas.jar " + pwd + "/Tejas/src/simulator/config/config.xml " + pwd + "/outputs/hello_world.output " + pwd + "/tests/hello_world.o"
print cmd
status = os.system(cmd)
if status != 0 or os.path.exists(pwd + "/outputs/hello_world.output") == False:
</