We're building a DXF exporter and from what I've read, this extremely simple file should be valid. We don't have any CAD tools to test with, so I'm very limited in my abilities to debug. This opens fine in the Proficad online viewer but I get an error from the Autodesk viewer, saying "The drawing file is invalid and cannot be viewed".
This is the file in its entirety. Any help is appreciated!
0
SECTION
2
ENTITIES
0
LWPOLYLINE
90
5
70
0
43
0.0
10
-8.75
20
-11.75
30
0.0
10
-8.75
20
11.75
30
0.0
10
8.75
20
11.75
30
0.0
10
8.75
20
-11.75
30
0.0
10
-8.75
20
-11.75
30
0.0
0
ENDSEC
0
EOF
A couple of issues with your DXF file.
LWPOLYLINE requires a bunch of extra overhead to use. You need a TABLES section and then you have to deal with AcDbEntity and AcDbPolyline entries. It gets complicated fast. Switching to the POLYLINE entity will save you a ton of headache.
You need a HEADER section for AutoCAD to open your DXF file. You don't have to put much in the HEADER, basically just version info.
Show below is a minimally functional DXF file (saved in R12 format) that will successfully open in AutoCAD:
0
SECTION
2
HEADER
9
$ACADVER
1
AC1009
0
ENDSEC
0
SECTION
2
ENTITIES
0
POLYLINE
5
7C
8
0
66
1
10
0.0
20
0.0
30
0.0
0
VERTEX
5
174
8
0
10
-8.75
20
-11.75
30
0.0
0
VERTEX
5
175
8
0
10
-17.5
20
0.0
30
0.0
0
VERTEX
5
176
8
0
10
-8.75
20
11.75
30
0.0
0
VERTEX
5
177
8
0
10
0.0
20
0.0
30
0.0
0
VERTEX
5
178
8
0
10
-8.75
20
-11.75
30
0.0
0
SEQEND
5
179
8
0
0
ENDSEC
0
EOF
If this is all you are going to put in your file, it should work just fine. Keep in mind that all DXF entities need a handle (basically an ID number).
0
POLYLINE
5
7C
The 5 above is the code that indicates the handle(ID number) will follow. The 7C is the actual handle. If you add more entities, you will need to increment the handle for each one, so every entity has a unique handle.
According to the official DXF spec from Autodesk (PDF here), the vertices of an LWPOLYLINE are 2D-only; e.g., they should only have 10 and 20 codes and NOT any 30 codes and since all of your 30 codes are 0.0 it shouldn't make a difference. If you do decide that the LWPOLYLINE needs to have Z-values other than zero, you can specify a code 38 pair (elevation) before your first 10 code pair.
If you need different Z-values for each point consider using POLYLINE with many VERTEX entities followed by a single SEQEND.
EDIT: While the DXF spec is supposed to be very free-form, I've found that the Autodesk implementation of it is very particular about what it can read.
Indeed the LWPOLYLINE is 2D only...
One more suggestions: go on AutoCAD and create a drawing similar to that, then export as DXF, that way you can compare with what you're designing.
Well your question is specific to particular data format problem in DXF which is missing/adding some values that AutoCad is not happy about. Your best chance to resolve this is try creating a similar file from the AutoCad and compare what you might have missed/added wrongly. Very difficult for others to debug for you in this situation. I have seen the DXF specifications pdfs from Autocad, have some writing DXF file help sections in the bottom, refer to them too.
Related
We got a cache given with 8 frames and it's directly mapped. Following access sequence on main memory blocks has been observed:
2 5 0 13 2 5 10 8 0 4 5 2
Count the hit rate of this organized cache.
Solution:
I understand how and why the numbers are placed in the table like that. But I don't understand why 2 and 5 have been bold-printed and why we got hit rate of 17%.
This has been solved by our professor but I don't understand it completely.
Like was mentioned by #Margaret Bloom in the comments, the numbers in bold refer to cache-hits. Non-bold refer to cache misses.
You might understand it better by using this simulator: cachesimulator.com
The Simulator works with WORD-instructions only, so a little conversion of your assignment need to be made in order to simulate it:
cache-size: 32 bytes (8 rows)
block-size: 4 bytes (one word per row)
associativity: 1 (direct-mapped cache)
replacement algorithm: LRU
memory size: (any number larger than (14*4) works) for example: 1024
Now since the simulator works with WORD-instructions you need to convert your access sequence by multiplying each number by 4, also, in the simulator you enter addresses in hexadecimal so after you have multiplied by 4 you convert to hexadecimal, then you get:
8 14 0 34 8 14 28 20 0 10 14 8
In the simulator you enter instructions on the form:
<operationtype><space><register><space><address>
In your case the operationtype is LOAD and the register does'nt matter. So you can use any register, for example:
LOAD 1 8
LOAD 1 14
LOAD 1 0
LOAD 1 34
LOAD 1 8
LOAD 1 14
LOAD 1 28
LOAD 1 20
LOAD 1 0
LOAD 1 10
LOAD 1 14
LOAD 1 8
Enter the instructions above in the text-area of the simulator and click run. You can then see the cache hits and misses in real-time and when the simulation is finnished you can analyze the results by looking at the content of the cache memory and the list of instruction-results. You can view the main-memory address that each element in the cache refers to by hovering over it.
I understand how and why the numbers are placed in the table like that.
So you understand which how addresses map to cache lines, and that the vertical axis is time.
But I don't understand why 2 and 5 have been bold-printed and why we got hit rate of 17%.
The table entries are bold (cache hit) when the previous access to the same cache line was to the same address. A different address that maps to the same cache line causes a cache miss (evicting the old contents).
Visually / graphically: look vertically upwards in the same column to see which data is currently hot in the cache line.
Obviously once you know how many cache hits there were, calculating the hit rate is easy.
Normally you should just ask your professor extremely basic questions like this. However, your diagram was really easy to understand, so it made this trivial question easy to understand and answer.
I'm currently facing an annoying problem, I have to read a big data file (500 GO) which is stored on a SSD revodrive 350.
I read the file using fread function as big memory chunks (roughly 17 mo per chunk).
At the beginning of my program everything goes smoothly It takes 10ms for 3 chunks read. Then after 10 sec read time performances collapse and vary between 60 and 90 ms.
I don't know the reason why this is happening and if it is possible to keep read time stable ?
Thank you in advance
Rob
17 mo per chunk, 10 ms for 3 chunks -> 51 mo / 10 ms.
10 sec = 1000 x 10 ms -> 51 GO read after 10 seconds!
How much memory do you have? Is your pagefile on the same disk?
The system may swap memory!
i was taking an exam earlier and i memorized the questions that i didnt know how to answer but somehow got it correct(since the online exam using electronic classrom(eclass) was done through the use of multiple choice.. The exam was coded so each of us was given random questions at random numbers and random answers on random choices, so yea)
anyways, back to my questions..
1.)
There is a CPU with a clock frequency of 1 GHz. When the instructions consist of two
types as shown in the table below, what is the performance in MIPS of the CPU?
-Execution time(clocks)- Frequency of Appearance(%)
Instruction 1 10 60
Instruction 2 15 40
Answer: 125
2.)
There is a hard disk drive with specifications shown below. When a record of 15
Kbytes is processed, which of the following is the average access time in milliseconds?
Here, the record is stored in one track.
[Specifications]
Capacity: 25 Kbytes/track
Rotation speed: 2,400 revolutions/minute
Average seek time: 10 milliseconds
Answer: 37.5
3.)
Assume a magnetic disk has a rotational speed of 5,000 rpm, and an average seek time of 20 ms. The recording capacity of one track on this disk is 15,000 bytes. What is the average access time (in milliseconds) required in order to transfer one 4,000-byte block of data?
Answer: 29.2
4.)
When a color image is stored in video memory at a tonal resolution of 24 bits per pixel,
approximately how many megabytes (MB) are required to display the image on the
screen with a resolution of 1024 x768 pixels? Here, 1 MB is 106 bytes.
Answer:18.9
5.)
When a microprocessor works at a clock speed of 200 MHz and the average CPI
(“cycles per instruction” or “clocks per instruction”) is 4, how long does it take to
execute one instruction on average?
Answer: 20 nanoseconds
I dont expect someone to answer everything, although they are indeed already answered but i am just wondering and wanting to know how it arrived at those answers. Its not enough for me knowing the answer, ive tried solving it myself trial and error style to arrive at those numbers but it seems taking mins to hours so i need some professional help....
1.)
n = 1/f = 1 / 1 GHz = 1 ns.
n*10 * 0.6 + n*15 * 0.4 = 12 ns (=average instruction time) = 83.3 MIPS.
2.)3.)
I don't get these, honestly.
4.)
Here, 1 MB is 10^6 bytes.
3 Bytes * 1024 * 768 = 2359296 Bytes = 2.36 MB
But often these 24 bits are packed into 32 bits b/c of the memory layout (word width), so often it will be 4 Bytes*1024*768 = 3145728 Bytes = 3.15 MB.
5)
CPI / f = 4 / 200 MHz = 20 ns.
I am using Phabricator for code reviews, and after tinkering with it, I have gotten it set up more or less exactly as I want.
I just have one problem, that I can't really find a solution to.
Navigating the phabricator app is smooth and has no delays. But when I write a comment (or chose any other action) in the Leap Into Action and press Clowncopterize it takes forever before it is done. The gears (busy indicator) in the lower right corner keep spinning for up to 60 seconds.
I can't figure out what the cause of this is. I have tried to do a top and I don't see anything severe:
top - 11:40:36 up 9 min, 1 user, load average: 0.04, 0.10, 0.07
Tasks: 112 total, 1 running, 111 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 2044148 total, 526580 used, 1517568 free, 36384 buffers
KiB Swap: 2093052 total, 0 used, 2093052 free, 257344 cached
There are no spikes when I press Clowncopterize either. I have made sure DNS is set up correctly. It wasn't to begin with, but is now. Even after a reboot, that didn't fix the performance problems.
The trouble was that sendmail was incorrectly set up. So it was waiting to time out on sending mails.
A program run on a parallel machine is measured to have the following efficiency values for increasing numbers of processors, P.
P 1 2 3 4 5 6 7
E 100 90 85 80 70 60 50
Using the above results, plot the speedup graph.
Use the graph to explain whether or not the program has been successfully parallelized.
P E Speedup
1 100% 1
2 90% 1.8
3 85% 2.55
4 80% 3.2
5 70% 3.5
6 60% 3.6
7 50% 3.5
This is a past year exam question, and I know how to calculate the speedup & plot the graph. However I don't know how to tell a program is successfully parallelized.
Amdahl's law
I think the idea here is that not all portion can be parallelized.
For example, if a program needs 20 hours using a single processor core, and a particular portion of 1 hour cannot be parallelized, while the remaining promising portion of 19 hours (95%) can be parallelized, then regardless of how many processors we devote to a parallelized execution of this program, the minimum execution time cannot be less than that critical 1 hour. Hence the speedup is limited up to 20×
In this example, the speedup reached maximum 3.6 with 6 processors. So the parallel portion is about 1-1/3.6 is about 72.2%.